CDbl

Coerces an expression to a Double.

Syntax: CDbl( expression )

expression
required Any valid string or numeric expression in the Double range — -1.79769313486231E308 to -4.94065645841247E-324 for negative values, and 4.94065645841247E-324 to 1.79769313486232E308 for positive values.

The return type is Double. If expression is outside the range of a Double, a run-time error occurs.

Use CDbl instead of Val to provide internationally aware conversions from a string to a numeric type. CDbl recognizes different decimal separators and different thousand separators properly, depending on the locale setting of your computer.

Example

This example uses the CDbl function to convert an expression to a Double.

Dim MyCurr, MyDouble
MyCurr = CCur(234.456784)                    ' MyCurr is a Currency.
MyDouble = CDbl(MyCurr * 8.2 * 0.01)         ' Convert result to a Double.

See Also

License: CC-BY-4.0 Code license: MIT Attribution: VBA-Docs