VBA/Excel/Access/Word/Data Type Functions/CInt

Материал из VB Эксперт
Перейти к: навигация, поиск

CInt() converts value to Integer

 
Sub intConvert()
    Debug.Print CInt(25 * 5.623)
End Sub



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