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 July 5, 2014)

6

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.

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

Changing Orientations within a Single Printout

Excel allows you to print out information in either portrait or landscape orientation, but what if you need both types of ...

Discover More

Rotating a Text Box

Text boxes are integral to the layout of many slides, especially if they contain text. Here's how to change the angle at ...

Discover More

Understanding Computer Names

Every Windows computer on your network has a name. This name typically provides some identifying information about the system ...

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)

Printing Workbook Properties

Want to create a printed record of the properties associated with a workbook? There is no easy way to do it in Excel. Here's ...

Discover More

Creating Individual Workbooks

Workbooks can contain many worksheets. If you want to pull a workbook apart and create a whole series of workbooks based on ...

Discover More

Tying Workbooks Together

If you work with multiple workbooks at the same time, you might wonder how to tie them together so they open and close and ...

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 five more than 2?

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.