CSNG(expression)

Returns the expression converted to a single data type (Single).


expressionThe expression to evaluate and convert to a single.

REMARKS
* If the expression passed to the function is outside the range of the data type being converted to, an error occurs.
* 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 the Microsoft documentation refer to docs.microsoft.com

Dim dbValue As Double 
dbValue = 100.123
CSng("0.00") = 0
CSng(dbValue) = 100.123

Debug.Print CSng("-100") '-100
Debug.Print CSng("100-") '-100

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