Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA's Round() method rounds a 5 in the last digit to the next EVEN
number (which is pretty standard in scientific and financial calculations, rather than XL's method that biases results away from zero). So 0.5 rounds to 0, 1.5 rounds to 2, 2.5 rounds to 2, 3.5 rounds to 4, etc... However, you can use XL's function: Public Sub rwnd() Dim c As Double c = 0.5 MsgBox Application.Round(c, 0) End Sub In article , "rd" wrote: I wonder why my VBA code is not rounding 0.5 to 1. The code below produces zero in the message box instead of the required 1. Public Sub rwnd() c = 0.5 MsgBox Round(c, 0) End Sub Any help would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH | Excel Worksheet Functions | |||
I need a formula with rounding up & rounding down to the nearest . | Excel Worksheet Functions | |||
Rounding | Excel Worksheet Functions | |||
Rounding | Excel Discussion (Misc queries) | |||
Worksheet rounding vs VBA rounding | Excel Programming |