How to split (copy) sheets from one workbook to individual workbooks?

MariaR323

New Member
Joined
Sep 13, 2017
Messages
12
So I have one workbook with about 50 worksheets (tabs). Is there a way to split each tab and save as their own workbook? Here's the quirk, the master workbook has one (lookup table) sheet that has to be copied with each of those other sheets.

Master Workbook (1 lookup tab + 49 tabs)
[lookup tab] [tab a] [tab b] [tab c] [tab d]....

So basically the [lookup tab] has to be copied with each of the rest of the tabs so I can save as a new workbook containing two tabs.

- new workbook 1 would contain [lookup tab] [tab a]
- new workbook 2 would contain [lookup tab] [tab b]
and so on...


I found the below VBA code in a search but I believe it's for single sheets only. Can anybody help?? I'd be very grateful as it would save me quite a bit of time.

Sub CreateNewWBS()
Dim wbThis As Workbook
Dim wbNew As Workbook
Dim ws As Worksheet
Dim strFilename As String

Set wbThis = ThisWorkbook
For Each ws In wbThis.Worksheets
strFilename = wbThis.Path & "/" & ws.Name
ws.Copy
Set wbNew = ActiveWorkbook
wbNew.SaveAs strFilename
wbNew.Close
Next ws
End Sub
 
Glad to help & thanks for the feedback

Fluff, help please...

I've been working with my file for the last couple weeks and I just tried to run my macro again and it doesn't run at all.

Is it because I've copied the original file and renamed it? Like my first file was Draft A, now I'm on Draft D... do I need to delete and renter the macro again?

Thanks!
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
As long as the new file is an .xlsm or .xlsb file then it should be ok.
Try going into the VB editor, click anywhere in the code & press F8 repeatedly, this will allow you to step through the code.
What happens?
 
Upvote 0
I don't know what happened but what I did in the meantime was I deleted the macro. Resaved my file as a regular Excel workbook. Then opened it back up again, created the macro again, resaved as macro excel file and now it worked!

Whew!!! Thanks for responding!!!
 
Upvote 0
Glad to hear you got it sorted :)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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