Page 272 - Excel Data Analysis
P. 272

15 537547 AppC.qxd  3/4/03  11:56 AM  Page 258







                    APPENDIX






                  VBA AND EXCEL EVENTS QUICK REFERENCE


                  (CONTINUED)


                  VBA STATEMENTS QUICK REFERENCE (CONTINUED)


                     Program Flow (Continued)
                      STATEMENT                                                       DESCRIPTION
                      Select Case testexpression                                      Executes one block out of a series
                      [Case expressionlist                                            of statement blocks depending
                       [statements]] ...                                              upon the value of an expression.
                      [Case Else
                       [elsestatements]]
                      End Select
                      [Private | Public | Friend] [Static] Sub name [(arglist)]       Declares the name, arguments, and
                      [statements]                                                    code that form a Sub procedure.
                      End Sub
                      While condition                                                 Executes a block of statements
                       [statements]                                                   as long as the specified
                      Wend                                                            condition is True.
                      With object                                                     Executes a block of statements on
                       [statements]                                                   a single object or on a user-defined
                      End With                                                        data type.
                     Variable Declaration
                      STATEMENT                                              DESCRIPTION
                      [Public | Private] Const constname [As type] = expression  Declares a constant value.
                      Dim [WithEvents] varname[([subscripts])] [As [New] type]  Declares variables and allocates the appropriate
                                                                             storage space.
                      Friend [WithEvents] varname[([subscripts])] [As [New] type]  Declares a procedure or variable to only have
                                                                             scope in the project where it is defined.
                      Option Compare {Binary | Text | Database}              Specifies the default comparison method to use
                                                                             when comparing strings.
                      Option Explicit                                        Forces declaration of all variables within the
                                                                             module.
                      Option Private                                         Indicates that all code within the entire module
                                                                             is Private. This option is used by default. You
                                                                             can overwrite the effects of this option by
                                                                             declaring a specific procedure Public.
                      Private [WithEvents] varname[([subscripts])] [As [New] type]  Declares variables and procedures to only have
                                                                             scope within the current module.


                   258
   267   268   269   270   271   272   273   274   275   276   277