Macro to separate worksheets into their own workbook

Jeffrey Green

Well-known Member
Joined
Oct 24, 2007
Messages
1,021
I get 1 workbook with a dozen or so worksheets, and I really need each sheet to be its own workbook, with the name of the book just being the tab name. Is there a macro out there to do this?


Thoughts?
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Maybe like this


Code:
Sub SheetToBook()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    ws.Copy
    With ActiveWorkbook
        .Name = ActiveSheet.Name & ".xls"
        .Close True
    End With
Next ws
End Sub
 
Upvote 0
Thanks, but I get this now:


Compile error

Can't assign to read-only property for the line

.Name = ActiveSheet.Name & ".xls"
 
Upvote 0
Sorry, it should be

Code:
Sub SheetToBook()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.workshets
    ws.Copy
    With ActiveWorkbook
        .SaveAs Filename:=ActiveSheet.Name & ".xls"
        .Close True
    End With
Next ws
End Sub
 
Upvote 0
:(, Now I get:

Run-time error '438"

Object doesn't support this property or method.


Does it matter that I am in 2003?

I can use 2007, that isn't a problem . . .thanks
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top