Microsoft Office Tutorials and References
In Depth Information
Automating Commands with Macros
9. Select the cells, enter the data, and choose the Excel commands
required to perform the tasks that you want recorded just as you
normally would in creating or editing the current worksheet, using the
keyboard, the mouse, or a combination of the two.
For the example macro, type the company name and click the Enter
button on the Formula bar to complete the entry in the current cell.
Next, click the Bold button and then click 12 on the Font Size drop-down
list in the Font group on the Home tab. Finally, drag through cells A1:E1
to select this range and then click the Merge and Center command
button, again on the Home tab.
After you finish taking all the actions in Excel that you want recorded,
you’re ready to shut off the macro recorder.
10. Click the Stop Recording button on the Status bar or Developer tab on
the Ribbon.
The square, blue Stop Recording buttons on the Status bar and the
Developer tab change back into circular red Record Macro buttons,
letting you know that the macro recorder is now turned off and no further
actions will be recorded.
Running macros
After you record a macro, you can run it by clicking the View Macros option
on the Macros button’s drop-down menu on the View tab, the Macros button
on the Developer tab of the Ribbon, or by pressing Alt+F8 to open the Macro
dialog box (see Figure 12-5). As this figure shows, Excel lists the names of all
the macros in the current workbook and in your Personal Macro Workbook
(provided you’ve created one) in the Macro Name list box. Simply click the
name of the macro that you want to run and then click the Run button or
press Enter to play back all its commands.
If you assigned a shortcut keystroke to the macro, you don’t have to bother
opening the Macro dialog box to run the macro: Simply press Ctrl plus the
letter key or Ctrl+Shift plus the letter key that you assigned and Excel
immediately plays back all the commands that you recorded.
The reason that macros you record in the Personal Macro Workbook are
always available in any Excel workbook is because the PERSONAL.XLSB
workbook is also open — you just don’t know it because Excel hides this workbook
immediately after opening it each time you launch the program. As a result, if
you try to edit or delete a macro in the Macro dialog box saved in the Personal
Macro Workbook, Excel displays an alert dialog box telling you that you can’t
edit a hidden workbook.
Search JabSto ::

Custom Search