Microsoft Office Tutorials and References
In Depth Information
Assignment Statements
Table 8-3: Operator Precedence
Operator
Operation
Order of Precedence
^
Exponentiation
1
* and /
Multiplication and division
2
+ and -
Addition and subtraction
3
&
Concatenation
4
= , < , > , <= , >= , <>
Comparison
5
In the statement that follows, x is assigned the value 10 because the multiplication operator has
a higher precedence than the addition operator.
x = 4 + 3 * 2
To avoid ambiguity, you may prefer to write the statement as follows:
x = 4 + (3 * 2)
In addition, VBA provides a full set of logical operators, shown in Table 8-4. For complete details
on these operators (including examples), use the VBA Help system.
Table 8-4: VBA Logical Operators
Operator
What It Does
Not
Performs a logical negation on an expression.
And
Performs a logical conjunction on two expressions.
Or
Performs a logical disjunction on two expressions.
Xor
Performs a logical exclusion on two expressions.
Eqv
Performs a logical equivalence on two expressions.
Imp
Performs a logical implication on two expressions.
The following instruction uses the Not operator to toggle the gridline display in the active
window. The DisplayGridlines property takes a value of either True or False . Therefore,
using the Not operator changes False to True and True to False .
ActiveWindow.DisplayGridlines = _
Not ActiveWindow.DisplayGridlines
 
Search JabSto ::




Custom Search