Page 207 - Excel Data Analysis
P. 207

10 537547 Ch09.qxd  3/4/03  12:13 PM  Page 193






                                                                  AUTOMATING ACTIONS WITH MACROS 9





                                                 It can be time consuming to try and determine whether an
                                                 Excel function has a VBA equivalent. To make the process
                                                 easier, you can use the Object Browser. The Object Browser in
                                                 the Visual Basic Editor lists the functions that are part of the
                                                 WorksheetFunction object. You can use any of the Excel
                                                 functions listed for the WorksheetFunction object to create
                                                 VBA macros or even other functions. See the section "Create a
                                                 Custom Function" for more information.
                                                 Click View ➪ Object Browser to display the Object Browser.
                                                 The Object Browser provides six different object libraries that
                                                 you can use to view object information. The Excel object
                                                 library contains all of the objects, properties, and methods
                                                 that correspond to the actual Excel program. To view the list of
                                                 available Excel functions, select Excel from the library list and
                                                 then type WorksheetFunction in the Search Text field. Click
                                                 the Search button and the Search Results window displays the
                                                 objects that match the search criteria. Click the
                                                 WorksheetFunction class to view a list of the Excel worksheet
                                                 functions that you can use in the VBA code.






























                     Á Type                   ■ As you type the argument   ° Switch to Excel and run   ■ The macro executes the
                     .FunctionName(arguments),   list, Microsoft IntelliType   the macro.         Excel function and returns the
                     replacing FunctionName   displays a list of the required                     appropriate results.
                     with the Excel Function and   arguments for the function.  Note: See the section "Run a Macro"
                     arguments with the                                 for more information.
                     corresponding function   ‡ Type any additional VBA
                     arguments.               code required to display the
                                              results of the Excel Function.
                                                                                                                     193
   202   203   204   205   206   207   208   209   210   211   212