Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company.
Learn more about Allen...
Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Editing Macros.
Taking a look at the programming code used in a macro (either ones you have recorded or macros created by others) is a great way to help you understand how the macro is put together and how it works. You can do this examination, and make changes to your macros, by editing them. This is done by first choosing the Macro option from the Tools menu. When you do, you will see a submenu from which you should select the Macros option. Excel displays the Macro dialog box. (See Figure 1.)
Figure 1. The Macro dialog box.
In the list of available macros you should choose the macro you want to edit. When you have selected one, you can click on the Edit button and the VBA Editor is displayed with the selected macro loaded and ready to edit.
Once your macro is displayed, you can make changes to it as desired. You use many of the same editing functions you use when making changes to a regular worksheet. Unless you fully understand the consequences of your changes, it is typically best to stick to recording simple macros. If you feel adventurous, however, there is nothing wrong with making changes to your macros to see what they will do. If you do so, it is a good idea to keep these tips in mind:
If you keep these tips in mind, there is very little chance that you will hurt anything. In fact, your chances of learning more about Excel and macro programming are much greater than the risk of damaging any data. Give it a try!
When you have finished making changes to your macro, you should close the VBA Editor. Closing the VBA Editor is done in the same manner as when you close any other Windows program—simply double-click on the Close icon in the upper-right corner of the window.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2331) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Editing Macros.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!