Microsoft Office Tutorials and References
In Depth Information
RUN A MACRO FROM A SHORTCUT KEY
The Personal Macro Workbook is a hidden workbook. There is nothing special
about the workbook. If you are curious, you can unhide it with the Unhide
command on the View tab. It should contain one worksheet and will be
completely blank. All the good stuff in the Personal Macro Workbook is visible
from the VBA editor.
To see the code pane in the Personal Macro Workbook, follow these steps:
Press Alt+F11 or select Developer, Visual Basic. If you have never used
macros before, you see a menu bar, a toolbar, and a lot of gray.
Press Ctrl+R or select View, Project Explorer to show the Project Explorer
pane. As shown in Figure 99, the Project Explorer lists each open workbook,
plus one workbook for each standard add-in installed on your computer.
Figure 99 shows the workbooks in collapsed mode. You might ﬁ nd that
some of your workbooks have been expanded to show worksheets and
Use the + sign next to PERSONAL.XLS to expand the tree view. Click the +
sign next to Modules to see a list of modules. If you just recorded your ﬁ rst
macro, you only see Module1. If you record more macros, Excel adds new
modules, such as Module2, Module3, and so on (Figure 100).
To see the code in any module, double-click the module in the Project
Explorer. Alternatively, right-click the module and choose View Code.
If you want to run a macro from this topic, you can type or paste it in any existing
module in PERSONAL.XLS. Note that after you change code in PERSONAL.
XLS and then you close Excel, you are prompted about whether you want to
save your changes to PERSONAL.XLS. Don’t forget to save at this point!
Summary: Several code samples in this topic are appropriate for the Personal
Macro Workbook. By following the steps in this selection, you can create the
Personal Macro Workbook.
RUN A MACRO FROM
A SHORTCUT KEY
Challenge: You recorded a macro but forgot to assign it to a shortcut key. Now
you need to change the shortcut key used for the macro. Excel documents the
shortcut key used when recording a macro in the comments at the top of the
macro. However, changing the comment in the macro does not have any effect
on the actual shortcut key used.
Solution: To change the shortcut key, press the F8 key to see a list of macros.
Click the macro in question and click the Options button in the Macro Options
dialog. You can edit the shortcut key here (Figure 104).