Page 94 - Excel Progamming Weekend Crash Course
P. 94

h540629 ch05.qxd  9/2/03  9:33 AM  Page 69


                                                                          SESSION



                                                                                 5










                                                                          Operators










               Session Checklist

               ✔ The assignment operator
               ✔ Numerical and string operators
               ✔ Logical operators
               ✔ Comparison operators

               ✔ Operator precedence


                     n operator is a symbol that instructs your program to carry out a specific action
                     with data, such as adding two numbers. Operators are essential for many programs,
               A including programs that perform numerical calculations and comparisons. VBA has
               several categories of operators that are used for different types of data and different kinds
               of operations.


               The Assignment Operator
               In VBA, the equal symbol (=) is the assignment operator, and is used to assign a value to a
               variable or property. For example,
                  x = 5

                  This line of code assigns the value 5 to the variable x. Note that this is a different mean-
               ing than the equal symbol usually has in mathematics, which is to state that the two items
               are, in fact, equal.
                  The rules for using the assignment operator are:
   89   90   91   92   93   94   95   96   97   98   99