VBA CDbl function

CDbl Function Description

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

Syntax

The syntax for the CDbl function in VBA is:

CDbl( expression )

Parameters

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

Other Notes

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

Example usage

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

CDbl 10
'Result: 10

CDbl 10.6
'Result: 10.6

CDbl "20"
'Result: 20

CDbl 10.12345678901234
'Result: 10,1234567890123