Round Function Error

  • Thread starter Thread starter Arvind Mane
  • Start date Start date
A

Arvind Mane

I think Gary''s Student have not understood my question. I know that 1.85 is
correct but if you run the macro then you can understand my question. The
Value of "a" is comming 1.84. This is an Error of Round Function. Can anyone
Help me to solve this Problem?




You don't need to do anything.

The value of 1.85 is correct (at least consistent with the worksheet function)
 
Hi Arvind,

If you truly want it to RoundUp, then change your procedure to:

Sub Data1()
Dim a As Double
a = 1.845
a = Application.WorksheetFunction.RoundUp(a, 2)
Debug.Print a
End Sub

Good Luck.
 
Try this:

Sub Data1()
Dim a As Double
a = 1.845
a = Application.WorksheetFunction.RoundUp(a, 2)
Debug.Print a
End Sub

Good Luck
 
Thank you ND Pard,
its Working fine.

ND Pard said:
Hi Arvind,

If you truly want it to RoundUp, then change your procedure to:

Sub Data1()
Dim a As Double
a = 1.845
a = Application.WorksheetFunction.RoundUp(a, 2)
Debug.Print a
End Sub

Good Luck.
 
Back
Top