roundup and rounddown

Lino

Active Member
Joined
Feb 27, 2002
Messages
429
I am simply trying to round numbers up or down.

Example if the numbers are: 49.6, 38.7 they need to be 49 and 38

For the round up it would be the opposite 50 and 39.

I can't get the roundup and rounddown function to work in the macro, i don't
know why? the round function seems to work but it doesn't do it correctly.

this is what I have so far...

Sub RoundUp()

SRow = ActiveCell.Row
SCol = ActiveCell.Column
RH = SCol - 4
FinalRow = Range("A65536").End(xlUp).Row

For i = SRow + 1 To FinalRow
If Cells(i, RH).Value <> 0 Then
Cells(i, SCol).Value = Round(Cells(i, RH), 0)
End If
Next i

End Sub

Thanks,

Lino
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Try using Application.WorksheetFunction.RoundUp
and
Application.WorksheetFunction.RoundDown

I hope this helps.
Kind regards, Al.
 
Upvote 0
If the round function is not working correctly then replace the round function with application.worksheetfunction.roundup(number,num_digits) or rounddown depending on what you want to do.

I hope this helps.
Kind regards, Al.
 
Upvote 0

Forum statistics

Threads
1,213,562
Messages
6,114,326
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top