Assigning Values to Variables
Values are assigned to variables creating an expression as follows: the variable is on the left side of the expression and the value you want to assign to the variable is on the right.
The following examples illustrates the use of the Assign Values to Variables:
Example 1:
B = 200 'Assigns the value 200 to the variable B.
Dim A
A = 100 'Assigns the value 100 to the variable A.
Example 2:
Dim Name
Name = "Alice" ' Assigns the string "Alice" to the variable Name.
Example 3:
Dim IsActive
IsActive = True ' Assigns the Boolean value True to the variable IsActive.
Example 4:
Dim X, Y, Z
X = 5
Y = 10
Z = X + Y ' Assigns the result of the expression (X + Y) to the variable Z.
Example 5:
Dim CurrentDate
CurrentDate = Date ' Assigns the current system date to the variable CurrentDate.
Example 6:
Dim A, B
A = 200 ' Assigns the value 200 to the variable A.
B = A ' Assigns the value of A to the variable B.