CDBL |
| CDBL(expression) |
Returns the expression converted to a double data type (Double). |
| expression | The expression to evaluate and convert to a double. |
| REMARKS |
| * The Double data type is a Value data type. * This function does no rounding. * The "expression" can be any number between -1.8 E+308 and +4.9 E+324. * If "expression" cannot be converted to a number you will get a type mismatch error. * If "expression" is outside this range, then an error occurs. * 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. * You can use the FIX function to return the integer portion of a number (truncating towards zero) (data type). * You can use the INT function to return the integer portion of a number (truncating down) (data type). * For a full list of conversion functions refer to the Explicit Conversion page. * For the Microsoft documentation refer to learn.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.Print TypeName(dbNumber) '= "Double"
Debug.Print CDbl(1.6) ' 1.6
Debug.Print CInt(1.6) ' 2.0
Debug.Print CLng(1.6) ' 2.0
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top