Hi
I have a variable called "MinVal" which is an integer. Does anyone know the correct code for rounding this integer to the nearest multiple of 5 (or 10)? I need to do this in VBA, not on the Excel worksheet.
Cheers
Johno
Hi
I have a variable called "MinVal" which is an integer. Does anyone know the correct code for rounding this integer to the nearest multiple of 5 (or 10)? I need to do this in VBA, not on the Excel worksheet.
Cheers
Johno
Re: Rounding integers in VBA
You could write a macro to extract the right most number, and then do a case statement to deal with it.
Jim
Re: Rounding integers in VBA
Hi
Have you tried
worksheetfunction.ceiling(minval,5) to round up
or
worksheetfunction.floor(minval,5) to round down
?
Re: Rounding integers in VBA
Take a look at
http://www.xldynamic.com/source/xld.Rounding.html
Rounding In Excel - Techniques
Don’t have an account yet? Register yourself now and be a part of our community!