Macro for Selecting Several Worksheets....

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

carl

I have a workbook that has 10 worksheets. After I select 6
worksheets, I am trying to find a way to have each
worksheet saved as a separate workbook.

Thank you for your help.
 
Try this

Sub test()
Dim sh As Worksheet
Dim Nwb As Workbook
Application.ScreenUpdating = False
For Each sh In ActiveWindow.SelectedSheets
sh.Copy
Set Nwb = ActiveWorkbook
Nwb.SaveAs "Sheet " & sh.Name & " of " _
& ThisWorkbook.Name & ".xls"
Nwb.Close False
Next
Application.ScreenUpdating = True
End Sub
 
You can use this also

For Each sh In Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5", "Sheet6"))

You don't have to select them this way
 
Back
Top