Macro for Selecting Several Worksheets....

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

Ron de Bruin

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
 
R

Ron de Bruin

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
 

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