Recording options

When you record your actions to create VBA code, you have several options in the Record Macro dialog box. The following paragraphs describe your options.

MACRO NAME

You can enter a name for the procedure that you are recording. By default, Excel uses the names Macrol, Macro2, and so on for each macro that you record. I usually just accept the default name and change the name of the procedure later. You, however, might prefer to name the macro before you record it. The choice is yours.

The Personal Macro Workbook

When you record a macro, one of your options is to record it to your Personal Macro Workbook. If you create some VBA macros that you find particularly useful, you might want to store these routines on your Personal Macro Workbook. This is a workbook named Personal.xlsb that is stored in your XLStart directory. Whenever you start Excel, this workbook is loaded, and you have access to the macros stored in the workbook. Personal.xlsb a hidden workbook, so it's out of your way when you're working in Excel.

The Personal.xlsb file doesn't exist until you record a macro to it._

SHORTCUT KEY

The Shortcut key option lets you execute the macro by pressing a shortcut key combination. For example, if you enter w (lowercase), you can execute the macro by pressing Ctrl+W. If you enter W (uppercase), the macro comes alive when you press Ctrl+Shift+W. Keep in mind that a shortcut key assigned to a macro overrides a built-in shortkey key (if one exists). For example, if you assign Ctrl+B to a macro, you won't be able to use the key combination to toggle the bold attribute in cells.

You can always add or change a shortcut key at any time, so you don't need to set this option while recording a macro.

STORE MACRO IN

The Store Macro In option tells Excel where to store the macro that it records. By default, Excel puts the recorded macro in a module in the active workbook. If you prefer, you can record it in a new workbook (Excel opens a blank workbook) or in your Personal Macro Workbook. (Read more about this in the sidebar, "The Personal Macro Workbook.")

Note Excel remembers your choice, so the next time you record a macro, it defaults to the same location you used previously.

0 0

Post a comment