Closing Excel when Closing the Last Workbook

Written by Allen Wyatt (last updated December 22, 2018)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


4

Jim noticed something frustrating when he was wrapping up a session with Excel. When he opens a workbook, everything is fine and works great. When he closes the workbook by clicking the close button at the upper-right of the program window, the workbook closes but Excel remains open. There is no workbook open at this point; only a blank Excel program window. He has to close it explicitly, which means an extra step when closing down Excel. He wonders if there is a way to make Excel close completely when he closes the last workbook on which he is working.

Before getting into theories and workarounds, it is good to review a bit about close buttons. Actually, in Excel 2007 and Excel 2010 there are two close buttons near the upper-right corner of the screen. One is red; if you hover the mouse over it, the ToolTip simply says "Close." This is the close button for Excel itself. The other is not red; if you hover the mouse over it, the ToolTip says, "Close Window." This is the close button to dismiss the document window.

In Excel 2013 and later versions this changed. There is now a single close button at the upper-right of the screen. Hover over it with the mouse and the ToolTip says "Close." In other words, Microsoft has done away with the "Close Window" button in later versions of Excel. Interestingly enough, the problem that Jim describes has also been done away with; it only exists in Excel 2007 and Excel 2010, and then only on some systems. (I verified this on several systems; the problem occurs when you click the Close button—the red one. On the last workbook, on some systems, it closes the workbook window, but leaves the program window open.)

The prevailing theory as to why this occurs in Excel 2007 and Excel 2010 is that Microsoft changed the way the Personal workbook was handled. As the story goes, since the Personal workbook is always open (even when it is hidden), the Excel program window stays open because Excel senses that a workbook (the Personal workbook) is still open.

Nonetheless, it is still frustrating. There is a way around it, but it involves changing how you close workbooks and the program. Instead of clicking on the close icon (the red X in the upper-right of the screen), use the following shortcut keys:

  • Ctrl+F4. This shortcut closes the active window, meaning that it closes whatever workbook you are viewing. (This is the same as clicking on the non-red Close button.)
  • Alt+F4. This shortcut closes the active application—Excel—and any document windows it may have open.

It is this second shortcut that is the handiest for shutting down Excel. It is interesting to note that in Excel 2013 and later versions these keys do essentially the same thing—they close one Excel workbook at a time. Even though both shortcuts close one Excel workbook at a time, Ctrl +F4 leaves Excel open while Alt+F4 closes Excel after the last workbook is closed. This is a completely different behavior than in earlier versions of Excel.

You could also try a modification on your red-X-clicking routine: Hold down the Shift key as you click. This modification has the same result as pressing Alt+F4, closing Excel and all open document windows.

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

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

Resizing a Text Box in a Macro

Text boxes are easy to add to a worksheet and manually resize, as needed. If you want to resize the text box in a macro, ...

Discover More

Pictures inside Shapes

Filling one of Excel's drawing shapes with a picture of your choosing is a neat trick. Here's how to do it.

Discover More

Pulling Access Information into Excel

If you have a lot of data stored in Access databases, you may want to get at that information using Excel. There are a ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (ribbon)

Slowing Down Mouse Selection

Ever tried to select a range of cells using the mouse, only to have the cells scroll by so quickly you can't make the ...

Discover More

Disappearing Status Bar

Ever had your Excel status bar disappear unexpectedly? Here's some ideas on why this may be happening.

Discover More

Disabling the F1 Key

Tired of hitting the F1 key by mistake and pulling up the Help system? Here are a couple of ways (one drastic and one not ...

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 three less than 3?

2023-02-22 18:29:49

Eric B

I have an unattended batch to save and close all open workbooks and have the same problem mentioned. It uses PTFBpro (free for testing) but maybe the free AutoIt would also work. Batch works because WINDOWTITLE of "empty" workbook is Excel and NOT the name of a workbook.

(For clarity here only new lines have "- " at beginning)
- :CheckExcelRun
- :: Check if Excel running
- TASKLIST | FIND "EXCEL" > NUL || GOTO <next>
- : Check if Excel is Open without a Workbook Open
- TASKLIST /FI "WINDOWTITLE EQ Excel" | Find "EXCEL.EXE" > NUL && (TASKKILL /IM "EXCEL.EXE" /F > NUL & GOTO <next>)
- :: Save and Close one Workbook
- %PTFB% /WAIT 2182 004D < click Save, click Close, close PTFBpro
- TIMEOUT 1 > NUL
- GOTO CheckExcelRun


2020-06-04 05:19:35

Alexis

You seem to be a rare excel user. For me who uses it on +20 different workbooks every day, it's actually frustrating that they changed it now and excel closes when I close the last sheet. So the program needs to restart several times a day, which every-time causes waiting time and reduces capacity. So from my point of view, the standard should be to keep Excel open!


2018-12-31 04:57:54

Mike Hodkinson

Simple solution:
If you don't want Excel to close when closing the last / only workbook open just use CTRL + W which closes the workbook but not the application.


2018-12-22 11:31:03

Joe

Good tip Alan. In the past i have used Control+W to close workbooks and then finally do the Alt+F4 on the empty application window. You have convinced me to use Alt+F4. I used Control+W because it worked for MS Word. But Alt+F4 works too.


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.