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

Rounding in Results

Rounding is a fact of life when it comes to using formulas in a worksheet. Sometimes that rounding can be a bit ...

Discover More

Quickly Selecting Cells

Need to quickly select a range of cells? Perhaps the easiest way is to use both the mouse and the keyboard together, as ...

Discover More

Using Macros in Protected Workbooks

Having problems with using macros in a protected workbook? There could be any number of causes (and solutions) as ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (menu)

Creating Worksheets with a Macro

Using a macro to add worksheets to your workbook is easy. This tip provides two different methods you can use.

Discover More

Assigning Macros to Graphics

The graphics you place in a worksheet can do more than just look pretty. You can also assign macros to a graphic, which ...

Discover More

Stepping Through a Non-Contiguous Range of Cells

Using macros to step through each cell in a selection is a common occurrence. What if that selected range is made up of ...

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