Figure Excels Macro dialog box


Macro Name:


1 -1

1 Macrol








Step into


scrolls heel 5hest3, kit

Si lGStS.S: rg i IChartTj/ pes


St^ib-jlCfvlfliriu.LL'iilS^fjw , ShawActfrateSteetDtebg

OP 9te

Macros in; |a|| open workbooks Description

Macro recorded 9fl3fid bf sr

Options ..

We should also comment on what appears and does not appear in the Macro list box. All macros that we write will appear in the Macros dialog box (as will all recorded macros). However, there are a few variations. If we give the macro a unique name (within the context given in the "Macros in" list box), then only the name of the macro will appear in the list box. If the name is not unique, then it must be qualified by the name of the module in which the macro appears, as in:

Sheet5.ScrollChartTypes in Figure 4-12. Unfortunately, the first version of a macro with a nonunique name is not qualified. (Note the presence of another ScrollChartTypes macro in Figure 4-12.)

Note that we can prevent a macro procedure from appearing in the Macros list box by making the procedure private, using the Private keyword, as in:

Private Sub HideThisMacro()

We will discuss Private and Public procedures in Chapter 6.

Finally, if you are like me, you will collect a great many macros over the years. As time goes by, you may forget the names of some of these macros and thus have trouble finding a macro when you need it. I would advise you to give some careful thought to creating a consistent naming convention for macros. I begin the names of all macros with a word that categorizes the macro. For instance, all of my macros that deal with worksheets begin with the letters Wks, as in:

Wks_Sort Wks Compare Wks_Print

Was this article helpful?

0 0

Post a comment