변수에 값 지정하기

값은 다음과 같이 표현식을 생성하는 변수에 지정됩니다. 표현식의 왼쪽은 변수이고 오른쪽은 변수에 지정할 값입니다.

다음 예에서는 변수에 값 지정을 사용하는 방법을 보여 줍니다.

예 1:

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

예 2:

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

예 3:

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

예 4:

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

예 5:

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

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