The VBA Int function rounds a supplied number down to an integer.
I.e. Positive numbers are rounded towards zero and negative numbers are rounded away from zero.
The syntax of the function is:
Where the Number argument is the number that you want the integer part of.
' Round the numbers 77.7 and -77.7 down to integers
Dim int1 As Integer
Dim int2 As Integer
int1 = Int( 77.7 )' Now, int1 = 77 and int2 = -78
int2 = Int( -77.7 )
In the above VBA code:
If the Int function is supplied with a value that cannot be interpreted as a number, it will return the error: