2.2 Comparisons
The most useful Boolean expressions are comparisons. These are expressions that we already know. For example, the Boolean
expression (x > y) compares the value of variable x to the value of variable y. This expression evaluates to true if and only
if the value of variable x is, indeed, larger than that of variable y.
The following comparison operators are supported by VBA (and many other programming languages):
- (x = y): true if and only if x equals y.
- (x <> y): true if and only if x is different from y.
- (x < y): true if and only if x is less than y.
- (x > y): true if and only if x is greater than y.
- (x <= y): true if and only if x is less than or equal to y. You can also say true if and only if x is not greater
than y.
- (x >= y): true if and only if x is greater than or equal to y. You can also say true if and only if x is not less
than y.