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:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (11079) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Office 365. You can find a version of this tip for the older menu interface of Excel here: Saving All Open Workbooks.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Workbooks can contain many worksheets. If you want to pull a workbook apart and create a whole series of workbooks based ...
Discover MoreExcel has the capability to automatically open workbooks when you first start the program. You may not want to have one ...
Discover MoreNeed to open a bunch of workbooks from within Excel? It's easy to do when you construct a selection set in the Open ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-03-08 21:01:21
Walter
I had multiple workbooks open in Excel 2010 and the Sub SaveAll() didn't work for me.
The following simple macro does the trick for me.
It prompts to save if changes were made in a workbook and also prompts with warning messages if need be.
Sub Close_all_Workbooks()
Workbooks.Close
End Sub
it also worked in Excel 2019, where the workbooks are open and multiple instances of Excel.
It's fairly simple and you may need to embellish it to do all of the things you would like.
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2021 Sharon Parq Associates, Inc.
Comments