To ensure that a mathematical operation returns an integer data type, use the CInt() function : CInt « Data Type Functions « VBA / Excel / Access / Word






To ensure that a mathematical operation returns an integer data type, use the CInt() function

 
Sub floatValue()
    Dim val1 As Single
    Dim val2 As Single
    Dim val3 As Integer
    val1 = 3.14
    val2 = 6.63
    val3 = CInt(val1 * val2)
End Sub

 








Related examples in the same category

1.CInt() converts value to Integer