Modifying a Macro - Auto Save WorkSheets as Workbooks

  • Thread starter Thread starter carl
  • Start date Start date
C

carl

I am working w/ the code below to take selected
worksheets and save them as individual workbooks. I now
would like to modify the code to always select worksheets
named "1" "2" and "3" amd always save them to a
designated network location "J:\Close". Could you please
help me modify the code.

Dim sh As Worksheet
Dim Nwb As Workbook
Application.ScreenUpdating = False
For Each sh In ActiveWindow.SelectedSheets
sh.Copy
Set Nwb = ActiveWorkbook

Nwb.SaveAs sh.Name & "_" & Format(Now, "mm-dd-yy")

Nwb.Close False

Next
Application.ScreenUpdating = True

End Sub
 
Carl,

Modify your code to use

For Each sh In Sheets(Array("1", "2", "3"))

and

Nwb.SaveAs "J:\Close\" & sh.Name & "_" & Format(Now, "mm-dd-yy")

HTH,
Bernie
MS Excel MVP
 
Back
Top