Understanding Phantom Macros

Written by Allen Wyatt (last updated September 9, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


Are you up for an experiment? Try the following: open a brand new workbook in Excel; one that has no macros in it. Record a quick macro, and then delete it. Save the workbook, close it, and reopen it. If all went as expected, Excel should have warned you about the workbook when you reopened it, and asked you if you wanted to disable the macros.

This sounds odd—after all, you know there are no macros in the workbook. Are there phantom macros at work here? No, not really. The reason Excel behaves this way is that when you create your first macro in a workbook, Excel creates a new module in which to retain the macro. When you later delete the macro, the module remains behind, ready to hold any other macros you may create. It is modules that Excel checks for when you open a workbook, not individual macros. If there is a module, you get the warning.

To fix this situation, you must follow these steps:

  1. Make sure the offending workbook (the one with the phantom macros) is open.
  2. Press Alt+F11, or choose Macros from the Tools menu and then choose Visual Basic Editor from the resulting submenu. Excel displays the Visual Basic Editor.
  3. Near the upper-left side of the editor is the Project Explorer. This contains a hierarchical tree that shows the different modules in your workbook. If the Project Explorer is not visible on your screen, press Ctrl+R to display it.
  4. Within the Project Explorer should be a folder called Modules. If it is not already open, double-click on the Modules folder to display its contents.
  5. Right-click on a module in the folder. A Context menu is displayed.
  6. Choose the Remove option from the Context menu. You are asked if you want to export the module before removing it.
  7. Click on the No button. The module is removed.
  8. Repeat steps 5 through 7 for each module in the Modules folder.
  9. Close the Visual Basic Editor.
  10. Resave your workbook.

At this point your workbook contains no modules, and you will not get any notification when you subsequently open it.

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 (2011) applies to Microsoft Excel 97, 2000, 2002, and 2003.

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 Chart Across Multiple Pages

Wouldn't it be great to have your huge charts print out on multiple pieces of paper that you could then piece together? ...

Discover More

Inserting Initials and Date in a Comment

When you insert a comment into a document, Word keeps track of who entered it and the date when it was entered. Here's ...

Discover More

Making All Occurrences Bold

Want to make instances of a given word or phrase bold throughout a worksheet? Here's a way you can make the change quickly.

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Mouse Click Event in VBA

Need to know if a particular cell is clicked with the mouse? Excel has no particular event handler for clicking in this ...

Discover More

Counting Commas in a Selection

If you have a range of cells in which you want to count all the commas, there are several ways you can derive the figure ...

Discover More

Transferring Data between Worksheets Using a Macro

Macros can be used for all sorts of data processing needs. One need that is fairly common is the need to move data from ...

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 1 + 1?

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.