Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Saving All Open Workbooks.

Saving All Open Workbooks

by Allen Wyatt
(last updated February 12, 2018)

7

If you work with lots of workbooks open at the same time, you know that it can be a pain to go through and save each of the open workbooks, in turn. Wouldn't it be great to have a single command that allowed you to save all the open workbooks, without the need to do it manually? Unfortunately, there isn't such a command in the versions of Excel that use the ribbon interface, but you can create one using a macro. The following is a good example of one you could use:
Sub SaveAll()	
    Dim Wkb As Workbook
    For Each Wkb In Workbooks
        If Not Wkb.ReadOnly And Windows(Wkb.Name).Visible Then
            Wkb.Save
        End If
    Next
End Sub
Save the macro in your Personal workbook, assign it to the Quick Access Toolbar or a shortcut key, and you can call it up as often as you like. It saves all the workbooks that are open, except those that are read-only or hidden.

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 (11079) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Saving All Open Workbooks.

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

Using Dynamic Chart Titles

Want the title of your chart to change based upon what is placed in a worksheet cell? It's easy; just add a formula to ...

Discover More

Setting Column Width in a Macro

Does your macro need to change the width of some columns in a worksheet? Here's how to do it.

Discover More

Adding Leading Zeroes to ZIP Codes

Import a bunch of ZIP Codes into Excel, and you may be surprised that any leading zeroes disappear. Here's a handy little ...

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 (ribbon)

Accessing a Problem Shared Workbook

What are you to do is you share a workbook with others, and then suddenly the workbook won't open properly? Dealing with ...

Discover More

Opening Two Workbooks with the Same Name

If you have two workbooks that each have the same name, opening them at the same time in Excel could cause some problems. ...

Discover More

Problems with Default Workbook and Worksheet Templates

You can create a default template for both your workbooks and worksheets. These should be placed in the XLSTART folder, ...

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. 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 four less than 4?

2018-08-17 10:32:09

Eric Maier

As usual, Allen, your post helped me. Thank you! I should mention though that this macro crashes when there are 2 instances of the same workbook open (View > New Window). Thanks, again!


2016-07-13 09:10:51

David Orchard

Up until Windows 10 and whatever version of excel I'm using, I just clicked on the cross on top-right corner and chose "Save all" - now its disappeared.


2016-03-09 21:46:28

MUBEEN

apply your code save all workbook above u mentioned.

but, i show the error "subscript out of range"

what reason pls reply tq


2014-10-30 10:14:35

Bigger Don

@ Doug

Allen's code is like one of my basic tool-kit Subs, included in every project and works until, tada!, someone uses a New Window.

Try this. It uses the Application.Window object fin the For...Next and Window.Parent is the workbook. It worked in my tests.

Sub SaveAll()
Dim Wkb As Workbook
Dim win As Window
For Each win In Application.Windows
If Not win.Parent.ReadOnly And win.Visible Then
win.Parent.Save
End If
Next win

End Sub


2014-10-29 17:00:46

Doug

It appears that this macro fails if you have more than one window open for the same workbook (ie, you go to view->new window). A way to modify the code to include this case would be helpful.


2014-08-15 08:01:35

Eva

Attempting to run this code results in a 'subscript out of range' error.


2014-07-13 00:32:32

Roger Bertrand, P. Eng.

Great tip. It worked fine.


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.