CINT(expression)

Returns the expression converted to an integer data type (Integer).


expressionThe expression to evaluate and convert to an integer.

REMARKS
* The Integer data type is a Value data type.
* The "expression" can be any value between -32,768 and 32,767.
* If "expression" is outside the range of the data type being converted to, an error occurs.
* If "expression" includes any fractions or decimals these are rounded.
* Any fractional parts less than or equal to 0.5 are rounded down to the nearest even number.
* Any fractional parts greater than 0.5 are rounded up.
* VBAs hexadecimal notation symbol is "&H"
* You can use the CDBL to return an expression converted to a double data type.
* You can use the CLNG to return an expression converted to a long data type.
* You can use the CSNG to return an expression converted to a single data type.
* For the Microsoft documentation refer to docs.microsoft.com

CInt(-1.1) = -2 
CInt(-1.9) = -2
CInt(0.2) = 0
CInt(0.5) = 0
CInt(0.6) = 1
CInt(0.9) = 1
CInt(1.1) = 1
CInt(1.5) = 2
CInt(2.5) = 2
CInt(2.6) = 3
CInt(11.5) = 12
CInt(12.5) = 12
CInt(12.6) = 13
CInt(12.9) = 13
CInt("&H75FF") = 30207
CInt("&H754") = 1876

Dim lPrice As Long
lPrice = 12.75
TypeName(CInt(lPrice)) = "Integer"

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top