Converting - Implicit

An implicit data type conversion is a conversion that happens automatically. Widening casts are often implicit.
VBA provides implicit conversion for a large number of data types


Integer to Long


Integer to Boolean

All numeric data types can be converted to boolean.
When converting a numeric VBA data type into a Boolean, 0 becomes FALSE and all other values (regardless of whether they're negative or positive) become TRUE.


Integer to String


Double to Integer


Double to String


Boolean to Integer

When converting a Boolean variable to a numeric VBA data type, TRUE becomes -1 and FALSE becomes 0.


String to Long

Strings that contain numerical values can be converted to numbers.


String to Boolean

Strings that contain boolean values can be converted to booleans.


Long to Integer - Overflow

If an implicit conversion is not possible you will get an overflow error
SS


Variant Data Type

When a variable is declared as a Variant data type all the conversions are done implicitly.
show examples


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext