Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, Iv assigned a value in vba to MyValue, Can somebody advise how I
round this up if the decimal is 0.5 or above, or down if below 0.5. Regards Robert |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
MyRoundedValue=Round(MyValue,0)
-- - K Dales " wrote: Hi, Iv assigned a value in vba to MyValue, Can somebody advise how I round this up if the decimal is 0.5 or above, or down if below 0.5. Regards Robert |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA's Round (added in xl2k) works differently from Excel's =Round().
You may want to stick with Excel's: Option Explicit Sub testme() Dim myValue As Double Dim iCtr As Long For iCtr = 1 To 4 myValue = iCtr + 0.5 MsgBox "myValue=" & myValue & _ vbLf & "Round=" & Round(myValue, 0) & _ vbLf & "Application.Round=" & Application.Round(myValue, 0) Next iCtr End Sub wrote: Hi, Iv assigned a value in vba to MyValue, Can somebody advise how I round this up if the decimal is 0.5 or above, or down if below 0.5. Regards Robert -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ROUNDING FORMULA =ROUND(B12/$B$10,1) ROUNDING TO HIGH | Excel Worksheet Functions | |||
Rounding up @ 3 instead of 5 | Excel Worksheet Functions | |||
I need a formula with rounding up & rounding down to the nearest . | Excel Worksheet Functions | |||
Rounding | Excel Worksheet Functions | |||
Worksheet rounding vs VBA rounding | Excel Programming |