Rounding a number to the nearest 5 or 10 or X
X = 1234 'number to roundN = 5 'rounding factorround(X/N)*N 'result is 1235
For floating point to integer, 1234.564 to 1235, (this is VB specific, most other languages simply truncate) do:
int(1234.564) 'result is 1235
Beware: VB uses Bankers Rounding, to the nearest even number, which can be surprising if you're not aware of it:
msgbox round(1.5) 'result to 2msgbox round(2.5) 'yes, result to 2 too
Thank you everyone.