Assign Operators

Syntax

var [Op] expr

Group

Assignment

Description

Assign a value to var.

Parameters

Op Description
= Assign the value of expr to var.
+= The same as: var = var + (expr). This language element is not VBA compatible.
-= The same as: var = var - (expr). This language element is not VBA compatible.
*= The same as: var = var * (expr). This language element is not VBA compatible.
/= The same as: var = var / (expr). This language element is not VBA compatible.
\= The same as: var = var \ (expr). This language element is not VBA compatible.
^= The same as: var = var ^ (expr). This language element is not VBA compatible.
<<= The same as: var = var << (expr). This language element is not VBA compatible.
>>= The same as: var = var >> (expr). This language element is not VBA compatible.
&= The same as: var = var & (expr). This language element is not VBA compatible.

Example


Sub Main
    X = 1
    X = X*2
    Debug.Print X ' 2
End Sub