Closing Excel when Closing the Last Workbook

by Allen Wyatt
(last updated September 7, 2013)

38

Jim notices 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 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 Excel 2013. 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 Xs 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 these keys do essentially the same thing—they close one Excel workbook at a time. This is a completely different behavior than in earlier versions of Excel.

If you are using Excel 2007 or Excel 2010 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, and 2013.

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

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

Changing Icons

Windows provide a surprising amount of flexibility when it comes to what you see on the screen. You can even make changes to ...

Discover More

Put Your Space Before or After?

When working with spacing between paragraphs, Word allows you to specify exactly how much space should be either before or ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (ribbon)

Thoughts and Ideas on Significant Digits in Excel

Ruminations and reflections about significant digits in Excel. Includes examples of how significant digits can affect the ...

Discover More

Using a Single Instance of Excel with Two Monitors

Working on a computer system that has multiple monitors can help increase your productivity. If you want to work with ...

Discover More

Setting the Width for Row Labels

Excel displays, by default, a row label or heading at the left side of each row on the screen. As you scroll down the screen, ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 7 + 5?

2017-04-27 09:22:56

MIchael Armstrong

Sometimes I can't decide if an app's behaviour is a feature or a bug. To me, closing Excel when the last workbook is closed is a bug. It makes sense, admittedly, until you decide to open a new workbook, at which time a new instance of Excel must be loaded. This takes an annoying amount of time, particularly if you're using a slow machine and/or a mechanical hard drive, and/or lots of addins. It's easy to fix, by defining a workbook that you close only when you're through with Excel and ready to shut down the system. It would be great if this workbook could be opened by default when Excel is started -- I suspect it's possible, but haven't looked into it.


2017-04-26 10:12:04

dennis

Still a problem in Excel 2013 for me - it started happening suddenly after being fine for the last 1.5 years. <shift>x will close the app, but it does seem poor planning that MS changed the behavior of a long-standing standard button.


2017-01-28 12:59:20

Kearney Crochet

If I use the close button at the top right of the screen (X) for a single session in Excel 2010, the session closes but a blank Excel screen remains. Presumably, this is a lingering Normal.dot. There is a way to have this lingering screen to close by "hiding" the dot file or screen. I found a reference to it once but haven't been able to come up with it again. Should not have to use Alt+F4 when closing the last or only open session.


2017-01-22 13:34:34

Alex McPherson

Hi Allen

Re: Excel 2000 doesn't close when clicking X

This problem has appeared recently.
We've been using Office 2000 (Excel & Word only) for years.
My wife and I are both on Win7
I use a laptop - Excel works fine.
She uses a desktop - the problem happens.

I've tried un-installing and re-installing Office 2000 several times.
I even activated the 'real administrator' user and installed from there.

By the way - until I de-selected Ignore other applications in Options- General..
I was getting "there was a problem sending the command to the program" when double clicking an XLS. Excel would run ok when started from its own shortcut.

We use Norton360 which so far has been pretty good.

Thanks in advance for your help.

Alex & Homai
Montreal, Canada


2017-01-04 16:50:12

John

My issue is slightly different. I close the excel 2013 file just fine but what remains is the same file but is showing in Header/Footer view. I have to close both windows. How do I stop from this happening? I had set up the headers and when I went to go back to normal view, this is when it happened. But now cannot fix.


2016-08-02 14:33:27

Mandi Daly

I frequently need multiple sessions of Excel (2013) open. I right click on the icon in the task bar and open a 2nd session, and open my file. When I am done, I file-close or hit the x for close window that I added to the QAT, but it still closes the entire Excel session. I'm not done with my multiple sessions. So I have to go back and reopen a 2nd, 3rd, etc session. How do you make this stop? It is very irritating.


2016-06-30 08:31:00

MIchael Armstrong

I have the opposite problem (Office 365 Home): I liked the old close options, where you had the choice of closing either the document, or the instance of Excel. Now, when you close the last document, Excel also goes away. Even with an SSD and a fast machine, that introduces extra delay when opening the next document, and introduces odd behavior when updating Excel.

I avoid this now by opening a blank workbook when Excel is started for the first time, but it isn't a very elegant solution to a problem I didn't have until Office 365 improved things.

Adding a Close File command to the Quick Access Toolbar provides the function, but it's on the left side, not on the right side where I'd like it.


2016-06-29 08:14:33

Austen Powers

Hi

You can customise the title bar at the top right hand side.
1. select the drop down arrow
2. select more commands
3. from the Choose Commands From
Dropdown menu select All commands
4. Select Close to close a workbook and
Exit to Close down Excel

Hope this helps


2016-02-08 18:44:08

Paul Abrams

Will Excel enable me to do the following: I’d like to create a 3-dimensional data plot (eg x-axis = Time; y-axis = Age of Consumer; z-axis = Value). And then import the plot into PowerPoint – and (most importantly) have a timelapse (eg 30-sec) “clip” that rotates the 3-D plot during the presentation.


2015-09-11 12:55:17

Kulitz

Delboy 08 Aug 2014, 18:01
To close Excel 2007 completely on the red x button in the top right hand corner when finished with the final workbook/sheet.

Go to Excel options in the top left hand menu button, go to advanced, scroll down to display and uncheck

Show all windows in the Taskbar

Click OK to return to the Excel workbook/sheet and close with the red x button in the top right hand corner.


-This works- Thx


2015-09-09 04:08:03

ken

Am using Excel 2007. Thanks for the explanation the "Personal" sheet is hidden, and that's the reason not "exit". "Shift" + clicking "Red X" works. Also, added an "Exit" button on the "Quick Access Toolbar" works. Tried a few times, and checked with Task Manager, it exits and ends the "Excel.exe" process.

Echo MaryAnn, Tom's suggestion of adding "Close All" in Quick Access Toolbar" does not work.

Thanks for the help.


2015-08-24 10:02:46

Tom

The Ctrl+F4 and Alt+F4 have the same result on my computer. It closes the current workbook, but does not close the program, still leaving the excel shell open.

What I did to fix this issue was go to the dropdown button next to the undo/redo arrows. It's called "Customize quick access toolbar", select 'more commands', under 'Choose commands from', Select 'All Commands', Find the 'Close all' button and add it to the toolbar, then hit 'OK', Now the new button didn't work for me originally, but once I removed it from the toolbar, excel seems to close correctly now.

Not sure why this worked, but hope it helps.


2015-06-25 11:45:19

Mary Ann

Nope, didn't work... I have 2013 and it is so annoying that after I close the last excel, that it reopens a new book... ALL THE TIME......wish we could go back to the old version, but not allowed at work.... it freezes up my computer as well when I have other large apps open... argh!


2015-06-15 15:04:35

KarenH

I have an older computer (4 yrs old), with windows 7 recently updated. Have had issues with Excel 2007 with personal workbook staying open. Thought with the update to Excel 2013 this issue would have been resolved. Even after using ALT-F4 to close excel, to close the empty window, I often have to head to the task manager to close Excel thru the processes tab because there is not enough resources to open a small 188kb file VERY FRUSTRATING and TIME CONSUMING


2015-04-08 09:41:51

Mike Beurmann

The Cntrl F4 and Alt F4 steps also address one of my problems: I use a USB hard disk, and when I attempt to "eject" it, the use of the red x results in Windows thinking the device is in use. When I use Cntr F4 and Alt F4 steps, Windows ejects the drive. Thanks for this tip!


2015-03-11 17:51:39

ltlrags

Sweet! I use different workbooks throughout the day and have become frustrated having to reopen the program each time with Excel 2013. This is a great tip.


2015-01-15 09:25:18

Tudor

Yes, I can confirm that as of 15Jan2015 clicking the top right X will close all windows including the hidden ones! Time to resume our lifes thanks MS for fixing your own bad choices.


2015-01-14 19:20:59

Charley

@Delboy:
There is no check box for "Show All Windows in the Taskbar" under Display in the Advanced options in Excel 2013. I did not notice this being a problem in Excel 2007 - there was an Exit command on the File menu and every book would close . . . I have put the Exit command on the QAT which is working for me.

The X in the upper right hand corner also seems to close everything for me . . .


2014-12-21 07:16:47

suhuso

How is this a problem? Just hit the red X if you want to quit the program - like Jeff I use EXcel all day and often have multiple workbooks open at the same time. It would be a real pain to reopen each one any time I want to close any of the others open in that instance of Excel.

Don Mattocks
to copy an entire worksheet intact into a new workbook in 2010,
right click the tab at the bottom with the sheet's name;
choose "move or copy" from the menu; check the "create a copy" box at the bottom of the window;
At the top in the drop-down menu for "To Book" choose the book you are sending it to, or "(new book)", if that is what you are creating.
If you are placing it in an existing workbook, you can also choose where you want to put it in the other book - just make sure the existing book is also open in the same instance of excel


2014-09-09 11:37:30

Tudor

Hi, I have Excel 2013 with a hidden personal.xlsb and personal.xlsm (I like some of my macros always available).
Alt-F4 only closes the current window, leaving open Excel window with the hidden workbook.
However Shift + click on the corner X closes both windows.
Too bad MS screwed this up and we have to use this workaround. If anybody has a permanent fix I would appreciate a reply. Thanks.


2014-08-26 11:26:45

Richard

After running with "Show all windows in the taskbar" unchecked for a while, I've ticked it again because it's a pain switching between open workbooks.


2014-08-25 09:30:51

Paul McKay

You say this problem has gone away in Office 2013 - well not quite. I find that if I use VSTO to open the Excel application, then closing the last workbook via the close button or Ctrl+F4 leaves Excel open - and it is also invisible, except to the Process Explorer. I don't want to close Excel from my VSTO app because it contains all the interesting stuff for the user to look at.
Alt+F4 does close Excel down, but it's not reasonable to expect mouse users to do that.


2014-08-11 03:31:05

Richard

Rock on, Delboy!


2014-08-08 18:01:36

Delboy

To close Excel 2007 completely on the red x button in the top right hand corner when finished with the final workbook/sheet.

Go to Excel options in the top left hand menu button, go to advanced, scroll down to display and uncheck

Show all windows in the Taskbar

Click OK to return to the Excel workbook/sheet and close with the red x button in the top right hand corner.


2014-02-12 06:55:39

Bryan

Adding a button is OK, but it's not the same behavior as before you have a personal workbook. I want to be able to close workbooks individually, then have Excel close when the last visible workbook is closed.

I've found a solution that's not 100% reliable (apparently due to the way Excel sporatically handles application.quit calls), but it works most of the time. First, I created a class module. In the Initialize procedure I create an Excel.Application object using WithEvents so that I can use the WorkbookBeforeClose event. When this event fires, I check if there are exactly 2 workbooks open, and if one of them is personal.xlsb, and if so, quit the application. I use an Auto_Open event in my personal macro workbook to create an instance of the class.

It works pretty well and alleviates that minor but persistant annoyance with always having to hit close one extra time.


2014-02-10 17:29:40

Watt

You can add an Exit button to the QAT.

And/or, in the Personal Workbook, in Private Sub Workbook_Open(), add this code:

Application.OnKey "%{F4}", "Application_Quit"

Elsewhere in the Personal Workbook, add this macro:

Sub Application_Quit()
Application.Quit
End Sub

Both methods seem to work only when there is one workbook open - the workbook and the program do close in one step. If more than one workbook is open, the workbooks close one by one with Alt-F4 until the last; closing the last with Alt-F4 closes the program in the same step.


2014-02-10 17:10:29

Watt

I was hoping that this page would provide a method in Excel 2013 to close the open workbook(s) and the program in one step, as Alt-F4 used to. (Ignoring saving issues.)


2013-09-17 06:22:09

MDC

Richard:
In Excel 2007, I found the command 'Exit' under the 'All Commands' heading while customizing my QAT. It's a grey 'X'. Killed everything I had open and exited the application.

Cheers!


2013-09-17 06:00:55

Richard

Scott - I tried adding various commands to the QAT but I haven't found one to close the application (in Excel 2007).


2013-09-16 16:07:40

Scott Renz

Hi Richard,

I surmised that by "proper" Jack meant the one you prefer--the one that would be "proper" for you.


2013-09-16 05:39:36

Richard

Jack - which is the proper close tool you mention?


2013-09-09 11:50:55

Graham Morris

As with Jeff, I like this feature in Excel 2007, I just wish Word 2007 did the same thing!(or can it be made to?)


2013-09-09 10:21:09

Jeff

Never occurred to me that this was a problem – it’s a benefit to me. I work with excel all day and frankly it would be a real pain to re-launch Excel every time I closed a workbook just open another.

If you want to close in the workbook AND Excel just click the red X. No problem.


2013-09-08 18:28:34

Peter Atherton

Heres another one.

Sub CloseSession()
' 1st Sept 2013

Dim myApp As Object
Dim wkb As Workbook
Dim shCount As Integer

Set myApp = Application
shCount = Worksheets.Count

For Each wkb In Workbooks
If wkb.Name <> Worksheets(shCount).Parent.Name Then
wkb.Save
wkb.Close
End If
Next

ThisWorkbook.Save
myApp.Quit

End Sub

I suppose you could change thisworkbook to activeworkbook if the procedure was in the personal file.


2013-09-07 19:11:23

Dave Hansen

Here is how I have been exiting my VBA program. Does your latest information about Excel not completely closing include the following code ??
This code has always completely closed Excel for my program in the past. I of course would go through a routine to save all the workbooks I had open prior to executing this code.

Application.EnableCancelKey=xlErrorHandler
Application.Quit
End Sub


2013-09-07 18:10:33

Don Mattocks

I just noticed something frustrating in both Excel 2010 and 2011 that I haven't seen before. I needed to copy a worksheet and put it into a new workbook. When I did, all blue text and highlighted cells turned from blue to an ugly orange. What am I doing wrong, or what setting have I forgotten to reset? It did it whether you chose paste, enter, paste special, or ctrl v.


2013-09-07 17:40:23

jef Player

Another option is to double click the ball at the top left of the screen...closes excel.


2013-09-07 15:36:22

Jack

You could also add the proper 'close' Tool you prefer to the Quick Access Toolbar (QAT) as I have been teaching my students to do since the introduction of Excel/Word/PPT 2010.


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.