• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Recording a Macro

The easiest way to create a macro is to use Excel’s macro recorder. You simply turn on the recorder, type a name for the macro, perform the task you want to record, and then stop the recorder. The following instructions lead you step-by-step through the process of recording a macro:

Open the Tools menu, point to Macro, and choose Record New Macro. The Record Macro dialog box appears, as shown in Figure 13.1, prompting you to name the macro.

Figure 13.1. Type a name for your macro in Excel’s Record Macro dialog box.

Type a unique, descriptive, and brief name for your macro, up to 64 characters (no spaces). The macro name must start with a letter—never a number. The macro recorder supplies a default name—Macro1, Macro2, and so on, as you keep recording macros—but nondescriptive names such as these are not very helpful when you’re trying to determine the purpose of each macro.

Open the Store Macro In drop-down list, and choose one of the following options:

Personal Macro Workbook to make the macro available in all workbooks.

New Workbook to have Excel create a new workbook and store the macro in that workbook.

This Workbook to make the macro available only in the currently open workbook.

To assign a shortcut key to the macro, click in the Shortcut key: Ctrl+ box and hold down the Shift key while pressing the letter key that you want to use in combination with the Ctrl key to launch your macro. This assigns the macro a Ctrl+Shift+ letter key shortcut.

Click in the Description text box, and type a brief description of the macro’s function (the task it performs).

Click the OK button. The Stop Recording toolbar appears with buttons for stopping the recording and for switching between relative and absolute cell references, as shown in Figure 13.2. (If the toolbar does not appear, right-click any toolbar and click Stop Recording.)

Figure 13.2. Excel’s Stop Recording toolbar can turn off recording when you’re done.

Perform the task whose steps you want to record. You can select menu commands, click toolbar buttons, and press keystrokes to enter commands. To select a cell, click it. To select a range of cells, drag over the cells. You can also type entries and select objects, such as charts and clip art.

When you are finished performing the steps, click the Stop Recording button, or open the Tools menu, point to Macro, and click Stop Recording. Excel saves your macro with the name you entered in step 2.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint