CSNG |
CSNG(expression) |
Returns the expression converted to a single data type (Single). |
expression | The expression to evaluate and convert to a single. |
REMARKS |
* The Single data type is a Value data type. * The "expression" can be any number between -1.3 E+38 and +1.3 E+38. * If the expression passed to the function is outside the range of the data type being converted to, an error occurs. * This function uses the locale setting to identify the different decimal separators and thousand separators. * You can use the CDBL function to return an expression converted to a Double data type. * 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. * For a full list of conversion functions refer to the Explicit Conversion page. * For the Microsoft documentation refer to learn.microsoft.com |
Debug.Print CSng("-100") '= -100
Debug.Print CSng("100-") '= -100
Debug.Print CSng("0.00") '= 0
Dim sgNumber As Single
Dim dbValue As Double
dbValue = 100.123
sgNumber = CSng(dbValue)
Debug.Print sgNumber
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top