lang • swap


SWAP ExpressionA , ExpressionB

Swap the contents of two expressions.

The two expressions must be able to act as the left part of an assignment.

This is a faster equivalent of executing the following code:

Dim Temp As Variant
Temp = ExpressionA
ExpressionA = ExpressionB
ExpressionB = Temp

ExpressionA and ExpressionB are evaluated twice: once as the left and once as the right hand side of an assignment, as shown above. Beware of side effects in your expressions!

See also