VBA CDec function

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

CDec Function Description

The VBA CDec function converts an expression (variable) to decimal value.

Syntax

The syntax for the CDec function in VBA is:

CDec( expression )

Parameters

expression
An expression / variable that is to be converted to decimal value.

Other Notes

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

Example usage

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

CDec 10
'Result: 10

CDec 10.6
'Result: 10.6

CDec "20"
'Result: 20

CDec 10.12345678901234
'Result: 10.1234567890123

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