View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Worksheet rounding vs VBA rounding

Or you could cut your own

Function myRound(num, Optional places As Long = 0)
If Int(num) Mod 2 = 0 Then
myRound = Round(num + 1 / (10 ^ places), places) - 1 / (10 ^ places)
Else
myRound = Round(num, places)
End If
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Xcelion" wrote in message
...
Hi Simon

You could use the same worksheet round function invoked using
WorksheetFunction.Round(arg1,arg2) in your VBA code

Thanks
Xcelion




"Simon Cleal" wrote:

Excel 2K

The VBA Round function uses 'Bankers rounding' (half the time the .5 is
rounded up, half the time down).

The worksheet ROUND() function uses 'normal rounding' (.5 is always

rounded
up)

Is there an easy way to make the VBA rounding the same as the worksheet
rounding

Thanks in advance
Simon