View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Michael Hudston Michael Hudston is offline
external usenet poster
 
Posts: 24
Default RoundUp not working in VBA

It worked for me. However I did put some msgbox to check the values of cost
and follow_up before doing the calculation. I suggest the same, and double
checking the numbers you are feeding into the roundup

I did it like this

Private Sub Test_Click()

Dim Cost As Double
Dim Follow_up As Double
Dim x As Double

Cost = 1

MsgBox Cost

Follow_up = 0.5

MsgBox Follow_up

x = Application.WorksheetFunction.RoundUp((Cost * Follow_up), 0)

MsgBox x


End Sub


" wrote:

Can anyone provide insight into why the following is not working?

x = Application.WorksheetFunction.RoundUp((cost * follow_up), 0)

cost = 1
follow_up = 0.5

but x is coming out as 0 instead of 1

Thanks.