Round Function Error

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)
 
N

ND Pard

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.
 
N

ND Pard

Try this:

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

Good Luck
 
A

Arvind Mane

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top