Atribuição de Valores a Variáveis

Os valores são atribuídos a variáveis por meio da criação de uma expressão, da seguinte forma: a variável no lado esquerdo e o valor que você deseja atribuir à variável no dado direito da expressão.

Os exemplos a seguir ilustram o uso de Atribuição de Valores a Variáveis:

Exemplo 1:

B = 200  'Assigns the value 200 to the variable B.
Dim A
A = 100   'Assigns the value 100 to the variable A.

Exemplo 2:

Dim Name
Name = "Alice"   ' Assigns the string "Alice" to the variable Name.

Exemplo 3:

Dim IsActive
IsActive = True   ' Assigns the Boolean value True to the variable IsActive.

Exemplo 4:

Dim X, Y, Z
X = 5
Y = 10
Z = X + Y   ' Assigns the result of the expression (X + Y) to the variable Z.

Exemplo 5:

Dim CurrentDate
CurrentDate = Date   ' Assigns the current system date to the variable CurrentDate.

Exemplo 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.