VBA Code to save to 2 locations

  • Thread starter Thread starter Sinjin341
  • Start date Start date
S

Sinjin341

I currently have code to save my workbook after running a couple o
procedures. I would also like to save the workbook to another locatio
as a backup on a different drive. Is it possible to save a workbook t
multiple locations in the same code set? Below is the code I alread
have.


Sub moverange()
x = Cells(Rows.Count, "A").End(xlUp).Row + 1
range(Cells(x, "A"), Cells(x + 0, "H")).Value
range("New_Entry").Value
range("New_Entry").Select
Selection.Clearcontents
range("A2").Select
ActiveWorkbook.Save
End Sub

Thank you,
Sinjin34
 
to save to the second location (this avoids changing the activeworkbook to
the backup copy)

range("A2").Select
ActiveWorkbook.Save
Application.DisplayAlerts = False
Activeworkbook.SaveCopyAs "C:\MyBackupFolder\" & ActiveWorkbook.Name
Application.DisplayAlerts = True

This overwrites a previous backup (with the same name) without prompt.
 
One way:

ActiveWorkbook.SaveCopyAs "C:\book2.xls"

saves it as a backup copy and does not change the active file to a new
filename.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top