When you convert a decimal value to an integer value it gets rounded to the nearest integer value.
Digits less than 5 are rounded down
Digits greater than 5 are rounded up
If the digit is 5, then it looks at the digit immediately before the decimal place
1) if its even, its rounded down
2) if its odd, its rounded up
3) if there is no digit, its rounded down

CLng(8.5) = 8 (because 8 is even)
CLng(9.5) - 10 (because 9 is odd)

More info Data Types > Converting
More info Numbers > Fixed Point
More info Numbers > Floating Point

© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext