Microsoft Office Tutorials and References
In Depth Information
+ Addition
- Subtraction
* Multiplication
/ Division
There are three others that are perhaps less common:
\ : Integer division without rounding. For example, 15 \ 4 evaluates to 3.
^ : Exponentiation (to the power of). For example, 2^4 evaluates to 16.
mod : Modulus (remainder after division). For example, 33 mod 6 evaluates to 3.
For both division operators, a Divide by Zero error occurs if the divisor is 0.
The String Operator
There is one string operation called concatenation , which simply joins two strings together. The
operator for this is & . For example, after this code:
Dessert = “Chocolate “ & “cake”
the variable Dessert contains “Chocolate cake” . There are lots of other things you can do
with strings, but they involve functions rather than operators. You can find information on these
functions in VBA’s online documentation.
The Comparison Operators
You use comparison operators to perform comparisons between two expressions. The result of a
comparison is either True or False depending on whether or not the comparison was true. The most
commonly used comparison operators, which are used primarily with numeric expressions, are
= Is equal to?
> Is greater than?
< Is less than?
>= Is greater than or equal to?
<= Is less than or equal to?
<> Is not equal to?
For example, the expression
a < b
asks the question “is a less than b?” and returns either True or False depending on the values of a
and b .
Search JabSto ::




Custom Search