What is Variable?
A Variable is a name given by users to assign a piece of data that is stored inside computer’s memory.Variables hold values of different data types that are specified when the variable is declared. Deceleration of variable includes four keywords in a particular order:
1. The Dim statement (VBA’s abbreviation for “Dimension”)
2. The name of your variable, which you create, such as vals_name
3. The word As.
4. The type of data being stored.[datatypes]
Dim vals_name As String
Dim vals_name1 as Integer, vals_name2 as Integer, vals_name3 as Integer
Dim vals_name1, vals_name2, vals_name3 as Integer
Assignment is very simple–
vals_name= Worksheets(“Sheet1”).Range(“A1”).Value [it automatically assume current application and current Workbook]