Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. 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 in Multiple Locations.
Written by Allen Wyatt (last updated March 4, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021
You may have a need to routinely copy a workbook to multiple locations on your system. For instance, the open workbook may need to be copied to a local hard drive and to several mapped drives that are actually on your office network.
Excel doesn't have a built-in capability to do this, but if the various locations are well defined, you can create a macro that will do the saving for you. The following macro is an example of such a tool:
Sub SaveToLocations() Dim OrigName As String OrigName = ActiveWorkbook.FullName ActiveWorkbook.SaveAs "G:\" + ActiveWorkbook.Name ActiveWorkbook.SaveAs "L:\" + ActiveWorkbook.Name ActiveWorkbook.SaveAs "K:\" + ActiveWorkbook.Name ActiveWorkbook.SaveAs "S:\" + ActiveWorkbook.Name ActiveWorkbook.SaveAs OrigName End Sub
The particular example of the macro saves the active workbook to five different locations, all using the same workbook name. The macro determines the current location of the workbook so that it can save to the current location last. The reason this is done is so that you can continue to use the regular Save tool and get the expected results.
If you want to use this macro on your own system, all you need to do is to make sure that you change the drive letters of where each workbook will be saved. If one of the drives you specify is for a location that uses removable media, and there is no media in the drive, then the macro will generate an error and stop. You'll then have to figure out where the workbook was originally saved so you can manually resave it there (using Save As).
Another peculiarity of the macro is that since it uses the SaveAs method, if there is already a workbook at each of the destinations with the same name as the current workbook, Excel will ask if you want the existing version of the workbook overwritten. This will always be the case with the last save, into the original location.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12495) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Saving in Multiple Locations.
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!
When processing plain text files in a macro, it is often helpful to know how much data the file contains. The normal way ...Discover More
Don't you hate opening a workbook and seeing error messages? If you see a message that some "invalid names" were detected ...Discover More
Delimited files are often created through Excel so that your data can be exported to other programs. If the delimited ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.