Needing to Save a Workbook Twice

Written by Allen Wyatt (last updated April 29, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021


1

Greg has several Excel workbooks that he uses on a regular or daily basis. But one is acting strange. The file consists of 14 worksheets. When he presses the Save button (either on the Quick Access Toolbar or File/Save) it shows the hourglass for a brief second. Then Greg immediately presses the Close button (top right "X" or File/Close) and Excel asks if he wants to save the file. This is the only workbook that does this; all of Greg's other workbooks close without asking him to save a second time. He wonders why this one file would be doing this.

Internally, Excel maintains what is known, at least colloquially, as a "dirty flag." In most simple terms, this is a True/False indicator as to whether something in the workbook has changed since the last time the workbook was saved. If something changes, then the flag is set to True. When you choose to close the workbook, Excel checks this flag and, if it is True, it asks you if you want to save your changes before closing.

So, in the case of Greg's workbook, the first culprit to suspect is something that is setting this dirty flag, making Excel think that something has changed in the workbook. This could be a macro that is changing something. For instance, there might be an event handler in the workbook that is run every time a different cell is selected. Or, perhaps there is a Workbook_BeforeClose event handler in place. Either way, the event handler may trigger within Excel the idea that something has changed within the workbook.

The only way to figure out if it is a macro is to do some detective work and examine the macros that may be saved in the workbook. Of course, this all assumes that the workbook is saved as macro-enabled, with the XLSM filename extension. If this is how the workbook is saved, then an easier way to figure out if a macro is involved is to follow these general steps:

  1. Open the workbook that is requiring multiple saves.
  2. Using, Save As, save the workbook in a non-macro-enabled (XLSX) format.
  3. Restart Excel and open the workbook you just saved.
  4. Go through your normal exit routine (save, then click on close) and see if the second save is still necessary.

Of course, if there are macros causing the issue, then it is possible those macros are necessary for proper functioning of the workbook in the first place. Further testing with the workbooks (both XLSM and XLSX formats) will be necessary to make that determination.

There are other things besides macros that could be causing Excel to think the workbook should be saved again. This has to do with what Excel terms "volatile functions," which are functions that, during recalculation, are automatically updated. This would set the dirty flag, and thereby make Excel think your workbook has to be saved again. You can learn about volatile functions at this Microsoft page:

https://learn.microsoft.com/en-us/office/client-developer/excel/excel-recalculation#volatile-and-non-volatile-functions

Of course, the entire irritation could be avoided if Greg simply changes his exiting routine—skip the step of saving and just close the workbook. If anything has changed in the workbook, Excel asks you if you want to save, and you can save at that point. In this approach you are relying on Excel to keep track of when saving is necessary and when it is not, which (as you now know) is something that Excel is going to do in any case.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9765) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021.

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

Temporarily Changing the Printer in a Macro

You can use a macro to print to any printer you have defined in Windows. It is good practice, if you are changing which ...

Discover More

Checking for a Security Certificate

Although Word macro viruses haven't been commonly used for some time now, hackers often try old, known techniques just to ...

Discover More

Changing References in a Lot of Defined Names

Need to change some cell references in your defined names? Changing one or two is easy; changing dozens is a good deal ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Workbook Loses All Conditional Formatting

Workbooks created in very old versions of Excel can, at times, have issues when opened in later versions of the program. ...

Discover More

Creating Workbooks for Individual Worksheets

If you have a workbook with lots of worksheets, you may want those worksheets to be saved off in individual workbooks. ...

Discover More

Comparing Workbooks for Differences

When working with copies of workbooks--particularly copies derived from a common ancestor workbook--you may be interested ...

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?

2023-04-29 07:55:27

Alex Blakenburg

A circular reference will behave in a similar manner to a volatile function.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.