Datasheet
Record a
Macro
A
macro enables you to automate common tasks.
You can use a macro to record any series of
commands you can execute in Excel. For
example, if you frequently apply a certain format to your
worksheet, you can record the steps for creating the
format and then play them back each time you want to
apply the format.
Clicking the Macro Recorder button opens the Record
Macro dialog box in which you can name your macro,
assign your macro to a shortcut key, and tell Excel where
you want to store your macro. You can name your macro
anything you want, with the following limitations: the
name must start with a letter; it can only contain letters,
numbers, and underscores; and it cannot contain any
spaces. You can assign any uppercase or lowercase letter
to act as the shortcut key.
In the Record Macro dialog box, the Store Macro In field
tells Excel where to store your macro. You can choose to
store your macro in the Personal Macro Workbook, a New
Workbook, or This Workbook. Use the Personal Macro
Workbook option if you want to make your macro
available to all Excel files. After you have stored a least
one macro in the Personal Macro Workbook, the
workbook opens whenever you open an Excel file. Use
the New Workbook option if you have specialized macros
that you want to use with multiple files. If you store your
macro in a new workbook, you can use the macros
whenever that workbook is open. Use the This Workbook
option if you want your macro to be in the workbook in
which you are currently working.
1 Click the Developer tab.
Note:
See the section, “Introducing Macros,” to learn how to
display the Developer tab.
•
Alternatively, click the Record Macro button on the status
bar and skip step 2.
2 Click Record Macro in the Code group.
1
2
7
5
3
4
6
Record a Macro
8
The Record Macro dialog box appears.
3 Type the name you want to give your macro.
4 Type the shortcut key you want to assign to your macro.
Press Shift as you type to assign an uppercase key.
5 Click here and then select the workbook in which you
want to store your macro.
6 Type a description of your macro.
7 Click OK.
04_132302 ch01.qxp 7/27/07 9:19 PM Page 8