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.

Saving in Multiple Locations

by Allen Wyatt
(last updated July 20, 2013)

13

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 (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.

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

Grabbing a User's Name from Excel

One of the settings you can make in Excel is to specify a user's name. This name is accessible through macros, and can ...

Discover More

Selecting Drawing Objects

Excel allows you to create all sorts of drawings using a wide assortment of tools. When you need to take an action upon those ...

Discover More

Customized Tables of Contents

Generating a table of contents is easy in Word. Changing how that table of contents looks is also easy, provided you change ...

Discover More

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!

More ExcelTips (menu)

Personal.xls File Not Opening

The Personal.xls workbook is used primarily to store macros that you want available through all of your workbooks. ...

Discover More

Opening Non-Excel Files

Not all data is created in Excel. Indeed, you may have data in files created by many other types of programs. You might be ...

Discover More

Use Filenames That Sort Properly

When storing your Excel workbook, you need to specify a file name to be used for the workbook. Take a moment to consider how ...

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. 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 1 + 3?

2016-09-17 14:41:20

John M

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.


2016-06-28 07:49:37

Kamala Y

Hi,

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???


2016-04-19 05:56:18

rajesh

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.


2015-12-09 13:53:54

kxc

*Where* does this macro used? Inside Excel?? Somewhere else? Please give more info! Thanks.


2015-11-03 05:26:08

Barry

@MS

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)

Call SaveToLocations

End Sub

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)

Call SaveToLocations

End Sub

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.


2015-11-02 18:49:36

MS

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.


2015-07-29 02:24:19

Ramnath Bandi

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.


2015-04-13 11:52:03

John K

Nice little routine. Worked perfectly for me. Thanks for sharing.


2015-03-27 06:51:21

Mark

Hi
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
C:documentsprojectlightingundercroft

and I want to save the same file to
D:documentsprojectlightingundercroft

and I want to do this for all Excel files without changing the second location in the macro.


2014-10-16 15:59:13

Syed Rizwan

Kindly let me know that, where should i upload the above MACROS


2014-07-31 21:52:51

genecorpus

where can I download this add in program called supursav....??....can you give me a link...I cant seem to find it...thanks....


2014-02-19 15:24:20

rj Usauskas

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!


2013-07-24 18:07:31

David Ruben

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).

Sub SaveToLocations()
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
ActiveWorkbook.SaveAs OrigName

Application.DisplayAlerts = True

End Sub


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.