Single Data Type in Excel VBA explained with syntax and examples. We use VBA data type single to store numbers which represents single-precision floating-point variables. The default value is 0 and store decimal values. The VBA data type single contains range of values -3.402823E38 to -1.401298E-45 for negative values, and 1.401298E-45 to 3.402823E38 for positive values.It is one of the VBA data type. It occupies 4 bytes(32 bits) in memory.
Note: It has type declaration character. It is nothing but character appended to a variable instead of data type. The type declaration character for single VBA data type is the explanation point(!).
Let us see the Data Type Single Syntax in Excel VBA.
Dim VariableName as Single 'or Dim VariableName!
Where VariableName represents the name of the variable.
and Single represents the type of data.
Here is an example on the VBA Data Type Single in Excel.
Sub VBAF1_Single_DataType() 'Integer Variable Declaration Dim iValue As Single iValue = 1 End Sub
You can convert an expression to Single VBA data type using VBA CSng function. Click on the following link to learn about CSng function and complete tutorial and examples.
VBA Data Types
Also read about all other data types.
You can refer the following link for the step by step instructions.
Click on the following links of the useful resources. These helps to learn and gain more knowledge.