| Start | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Concatenation Operators VBA supports 2 different concatenation operators, If the Note that the If either side is a numeric type and the other side is a This behavior can lead to subtle, hard to debug errors - especially if |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comparison Operators
NotesThe VBA syntax allows for "chains" of comparison operators, but these constructs should generally be avoided. Comparisons are always performed from left to right on only 2 operands at a time, and each comparison results in a ...may be read in some contexts as a test of whether Any comparison operator other than If the If the literal If the default member of the ...will be evaluated as: If either operand is a numeric type and the other operand is a If both operands are a For this reason, make sure that If one operand is a If the other operand is a Care should be taken when making comparisons between |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mathematical Operators Listed in order of precedence:
1 Multiplication and division are treated as having the same precedence. 2 Addition and subtraction are treated as having the same precedence. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Bitwise \ Logical Operators All of the logical operators in VBA can be thought of as "overrides" of the bitwise operators of the same name. Technically, they are always treated as bitwise operators. All of the comparison operators in VBA return a Boolean (opens new window), which will always have none of its bits set ( Assigning the result of an expression using one of these operators will give the bitwise result. Note that in the truth tables below,
Returns
Returns
Returns
...the VBE will change the line to: Similar simplifications will be made to any expression that contains a left-hand operand (including expressions) for
Also known as "exclusive or". Returns
Note that although the
Also known as "equivalence". Returns
Note that the
Also known as "implication". Returns
Note that the RemarksOperators are evaluated in the following order:
Operators with matching precedence are evaluated from left to right. The default order can be overridden by using parentheses |
Read Article
https://develop.horje.com/learn/1434/reference