VBA CInt function

CInt Function Description

The VBA CInt function converts an expression (variable) to Integer data type.

Syntax

The syntax for the CInt function in VBA is:

CInt( expression )

Parameters

expression
An expression / variable that is to be converted to Integer data type.

Other Notes

If the expression / variable can’t be converted to a Integer, the function with return Error code 13: Type mismatch.

Example usage

The CDate function can be used in VBA code. Let’s look at some VBA CInt function examples:

CInt 10
'Result: 10

CInt 10.6
'Result: 11

CInt "12"
'Result: 12