variable answer will hold the value 32 after execution of this block, not 31.8 as you might want. : Data Type « Data Type « VBA / Excel / Access / Word






variable answer will hold the value 32 after execution of this block, not 31.8 as you might want.

 
Sub IntegerType()
    Dim answer As Integer
    Dim num1 As Single
    Dim num2 As Integer
    num1 = 5.3
    num2 = 6
    answer = num1 * num2
    Debug.Print answer
End Sub

 








Related examples in the same category

1.Common Data Types
2.Constants are declared using the Const keyword