Modifying a Macro - Auto Save WorkSheets as Workbooks

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
 
B

Bernie Deitrick

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
 

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

Top