SECTION 3
Lesson 3.1: Creating Macros in Excel

   

 

 

When you play a macro, the actions or keystrokes you recorded will be performed in sequence automatically. To play a macro, choose Tools->Macro->Macros to open the macro dialogue box.

 

 

Here you can see three macros available for use. The one that has been selected, called anotherMacro, has been stored with this worksheet. You can tell because it does not have Personal.XLS! in front of its name. Personal.XLS indicates that the macro is stored in the personal macro workbook.

 

To play the selected macro, click the Run button. To view or edit the visual basic code for the selected macro, click the Edit button. To delete the macro click the Delete button.

 

When you click the Run button, the Macro dialogue box will disappear, and the sequence of instructions that was recorded in the macro will be performed on the current workbook.

 

Note: you can see the macros from this workbook, and from the personal macro workbook, because the All open workbooks option is selected in the bottom drop list of the macro dialogue box. If you select the This workbook option from the list, or the Peronal.xls option, only the macros corresponding to the specific option you select will be shown.

 

You can also run a macro by using shortcut keys, or by clicking a button. The explanation for these options will follow.