Saving in Multiple Locations
Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Saving in Multiple Locations.
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:
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
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 (2774) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Saving in Multiple Locations.
Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!
Leave your own comment:
Comments for this tip:
John M 17 Sep 2016, 14:41
Can this macro be run from the personal workbook? I would find it useful for some of my files, but not for all of them. I'm a rank novice at macros, but I believe I would be capable of running it from an icon an the toolbar or create a short-cut key code to run it when required.
Kamala Y 28 Jun 2016, 07:49
Thanku for the code. Makes ones life easier in saving an excel at multiple locations.
I have tried the above code on a Shared Workbook. Every time multiple users update the excel and click on save, "RunTime Error 1004" is displayed.
How do we resolve this issue???
rajesh 19 Apr 2016, 05:56
i have two computers in my office, one excel file running in both computers, so my problem is computer1 is running the excel file and save that file. at same time computer2 excel file also saved i want this.
kxc 09 Dec 2015, 13:53
*Where* does this macro used? Inside Excel?? Somewhere else? Please give more info! Thanks.
Barry 03 Nov 2015, 05:26
All you need to do is to call the macro from the required Workbook or Worksheet event.
e.g. to run this after the Workbook is saved
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
This should be placed on the "ThisWorkBook" codepage
To run the macro if there is a change to a Worksheet:
Private Sub Worksheet_Change(ByVal Target As Range)
This should be placed on the codepage for the Worksheet for which you want the changes monitored.
The SaveToLocations macro itself should be placed in a Module.
MS 02 Nov 2015, 18:49
Hello. Firstly, thank you for this tip. It runs beautifully. However, how can I get this macro to run automatically when I make a change (any change) to the worksheet/book? The macro works, but only if I force it to run. I'd like it to run automatically when I hit the "save" button after making a change to the worksheet/book. I look forward to your response. Thank you.
Ramnath Bandi 29 Jul 2015, 02:24
Thanks Sir for this useful tip. I would like to additionally avail following functionality.
Once a file is saved in several locations above macro,if a sheet is edited thereafter it should be reflected in the other saved files too.
John K 13 Apr 2015, 11:52
Nice little routine. Worked perfectly for me. Thanks for sharing.
Mark 27 Mar 2015, 06:51
Is there a way to make this look up the file path and copy that to the different drive reference, but the same folder layout?
I want it to apply to any Excel file I use and create a backup to the same location on a different drive.
For example, I save an Excel file to
and I want to save the same file to
and I want to do this for all Excel files without changing the second location in the macro.
Syed Rizwan 16 Oct 2014, 15:59
Kindly let me know that, where should i upload the above MACROS
genecorpus 31 Jul 2014, 21:52
where can I download this add in program called supursav....??....can you give me a link...I cant seem to find it...thanks....
rj Usauskas 19 Feb 2014, 15:24
A program called SupurSAV (SS) has finished Beta testing, works with Office Word/Excel. Add-in creates a menu entry on standard toolbar...you specify drives to save to (program parses out drives available...BIG difference from standard MS offering showing ALL drives)...a simple click of Save from SS menu or added icon saves to all locations specified for your session. Works with all media INCLUDING sky type drive if mapped...Lots of other bells and whistles but don't really care...Saves to satellite locations under folder SupurSAV/Application Type/ (e.g., Word Document, Excel Spreadsheet)...slick and quick!
David Ruben 24 Jul 2013, 18:07
To prevent Excel asking whether to overwrite the file if it already exists, set DisplayAlerts to false, but as this is not automatically reset at the end of a macro, one must remember to reset this back on (true).
Dim OrigName As String
OrigName = ActiveWorkbook.FullName
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "G:" + ActiveWorkbook.Name
ActiveWorkbook.SaveAs "L:" + ActiveWorkbook.Name
ActiveWorkbook.SaveAs "K:" + ActiveWorkbook.Name
ActiveWorkbook.SaveAs "S:" + ActiveWorkbook.Name
Application.DisplayAlerts = True