-
I am using VB6 professional and need to round a number up to the next integer. I understand that the Round Function will round down for decimals less than 0.5 and round up for decimals 0.5 or greater. I need to round up to the next integer for all decimal values, no matter how small (or at least to 4 decimal places). I am new to Visual Basic so please bear with me. Any code examples would be very welcome.
Thanks,
Steve.
-
This will help ya!
There was a post at 31-8-2000 about the same subject, so take a look at it!
http://forums.vb-world.net/showthrea...threadid=28747
-
Try this:
Code:
y = Int(x) + IIf(x = Int(x), 0, 1)
-
I use
Fix(num + .5)
if negative number want to round down then
Fix(num + .5 * Sgn(num))
-