CDBL(expression)

Returns the expression converted to a double data type (Double).


expressionThe expression to evaluate and convert to a double.

REMARKS
* The Double data type is a Value data type.
* The "expression" can be any number between (- 1.8 E+308) and (+ 4.9 E+324)
* If "expression" is outside this range, then an error occurs.
* The range for a single data type is: - 1.3 E+38 to + 1.3 E+38
* This function uses the locale setting to identify the different decimal separators and thousand separators.
* You can use the CINT function to return an expression converted to an integer data type.
* You can use the CLNG function to return an expression converted to a long data type.
* You can use the CSNG function to return an expression converted to a single data type.
* For a full list of conversion functions refer to the Explicit Conversion page.
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print CDbl(30)            '= 30  
Debug.Print CDbl("0.00") '= 0
Debug.Print CDbl(#01/07/77#) '= 28132
Debug.Print CDbl("-100") '= -100
Debug.Print CDbl("100-") '= -100

Dim dbNumber As Double
Dim iNumber As Integer
iNumber = 20
dbNumber = CDbl(iNumber)
Debug.Print dbNumber
Debug.Pring TypeName(dbNumber) '= "Double"

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top