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

Implementing a Dynamic Document Control Table

Accurately and repeatedly referencing information within a document is a common task that needs to be done. One way to ...

Discover More

Totaling Across Worksheets

Want to sum the values in the same cell on a range of worksheets? It's not as easy as summing a range on the same ...

Discover More

Counting Consecutive Negative Numbers

If you have a range of values that can be either positive or negative, you might wonder how to determine the largest ...

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)

Debugging a Macro

Part of writing macros is to make sure they work as you expect. This involves a process known as debugging. Here's how ...

Discover More

Macros in Template Files

People often place macros in template files to perform any number of tasks. This tip describes a situation where the link ...

Discover More

Relative References when Recording Macros

When you record a macro, make sure that you know how Excel is recording your cell movements. This tip explains the ...

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 two more than 7?

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.