VBA CLng function

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

CLng Function Description

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

Syntax

The syntax for the CLng function in VBA is:

CLng( expression )

Parameters

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

Other Notes

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

Example usage

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

CLng 10
'Result: 10

CLng 10.6 
'Result: 11

CLng "20"
'Result: 20

Simply the best place to learn VBA!

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match