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.

Editing Macros

Written by Allen Wyatt (last updated August 20, 2022)
This tip applies to Excel 97, 2000, 2002, and 2003


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:

  • As you are developing and testing macros, always use copies of your data. Keep the original data stored in a safe place.
  • Keep a good macro language function reference or command reference close by.
  • Test often as you make changes. Don't make all your changes at once and then expect to perform one test and have everything work. Unfortunately, life is not that simple.

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.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

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.

Author Bio

Allen Wyatt

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. ...

MORE FROM ALLEN

Printing a Number of Different Pages

If you don't need to print an entire workbook, it can be confusing to figure out how to print just certain pages. This ...

Discover More

Setting Print Ranges for Multiple Worksheets

Need the same print range set for different worksheets in the same workbook? It can't be done in one step manually, but ...

Discover More

Overcoming Automatic Word Selection

When you select text with the mouse, Word usually selects entire words for you. If you don't want to do this, you can use ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Understanding the While...Wend Structure

Logical structures are important in programming, as they allow you to control how the programming statements are ...

Discover More

Understanding Phantom Macros

When you delete all the macros in a workbook, Excel may still think you have some there. Here's why that happens and what ...

Discover More

Updating Automatically When Opening Under Macro Control

If your workbook contains links, you are normally given the opportunity to update those links when you open the workbook. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four minus 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.