CVar Function Description
The VBA CVar function converts an expression (variable) to Variant data type.
Syntax
The syntax for the CVar function in VBA is:
CVar( expression )
Parameters
expression
An expression / variable that is to be converted to Variant data type.
Other Notes
The Variant data type is the default data type for undeclared variables. Using it is inefficient and may result in your VBA running much slower. Read more here (item 12 in table)
Example usage
The CVar function can be used in VBA code. Let’s look at some VBA CVar function examples:
CVar "10" 'Result: "10" (Variant/String) CVar 10 'Result: 10 (Variant/Integer)