Re: VBA round
- From: JE McGimpsey <jemcgimpsey@xxxxxxxx>
- Date: Thu, 01 Sep 2005 11:22:02 -0600
The Round method was introduced into VBA in VBA6 (XL2000 and later). If
you're using XL97 or MacXL, use
Range("A1").Value = Application.Round(X)
Note that VBA's Round and XL's ROUND treat a 5 in the last significant
digit differently - XL always rounds away from zero, VBA always rounds
to the nearest even digit:
VBA: Round(2.5, 0) ===> 2
Round(3.5, 0) ===> 4
XL: Round(2.5,0) ===> 3
Round(3.5,0) ===> 4
In article <67048C96-E40C-41A2-BB42-A276965DF99E@xxxxxxxxxxxxx>,
"Jeff" <Jeff@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I am writing VBA.
>
> How do I round.
>
> I tried "Range("A1").value = Round(X)"
> where I set X = 6.7
>
> But it gave an error on the "Round()" - it said it was not defined function.
> Is there a function that can round in VBA?
.
- References:
- VBA round
- From: Jeff
- VBA round
- Prev by Date: RE: If Statement on Excel version 2002
- Next by Date: Re: CHANGE WHOLE EXCEL work*** TO UPPERCASE LETTERS?
- Previous by thread: Re: VBA round
- Next by thread: Re: VBA round
- Index(es):