This article covers that method to use VBA data types and assign a variable which stores the value in system memory, it is very important to know which data type should be used during VBA coding , wrong selections of data types can make processing slower and hits to the system’s memory.
Correct selection of data type helps to improve the processing of a written procedure with faster output.
Data types and uses
- Integer – stores number values without decimal
- Double – helps to stores values and manage according to width / digit (1.2332, 1.2, 789965457) and data is consistence
- Variant – stores all data type including error values (err, div, n/a ) etc.
- String – stores all type of data – like text, numeric, alpha numeric, date ( etc.) – out as text value
- Date – belongs to day, month and year
- Time – belongs to hour, minute and second
- Long -long numbers (avoid overflow error for long integer values)