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(!).
VBA Data Type Single Syntax in Excel
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.
Example on the VBA Data Type Single in Excel
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
Convert an Expression to VBA Data Type Single in Excel
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.
Instructions to Run VBA Macro Code or Procedure:
You can refer the following link for the step by step instructions.
Instructions to run VBA Macro Code
Other Useful Resources:
Click on the following links of the useful resources. These helps to learn and gain more knowledge.
VBA Tutorial VBA Functions List VBA Arrays VBA Text Files VBA Tables
VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers Blog
2 thoughts on “Single Data Type in Excel VBA”
Just wanna remark that you have a very nice web site, I enjoy the layout it really stands out.
If some one needs expert view regarding blogging then i suggest him/her to pay a visit this website, Keep up the nice job.