Examples: CInt function
Example 1
' Convert string to integer
' Display value and data type
Dim nvar As Variant
Dim nstr As String
nstr = Inputbox("Number", "Enter any number", "0")
If Isnumeric(nstr) Then
nvar = Cint(nstr)
Messagebox nvar,, Typename(nvar)
Else
Messagebox nstr,, "Not a number"
End Sub
Example 2
' Convert a Currency value to Integer.
Dim x As Currency
x@ = 13.43
Print CInt(x@) ' Prints 13