Macro Move Sheets

Packfan86

New Member
Joined
Jun 24, 2008
Messages
26
Hey everybody,


I have about 80 sheets in a workbook, and I would like to put each sheet into it's own workbook, and have that new workbook called by the value in Column A. Does anybody know how I would do this?

Thanks in advance!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Not a jot.

Okay, time for stupid questions.
1. Have you put the code in a standard module in your workbook with 80 sheets?
2. Where is your workbook with 80 sheets saved? Have you thoroughly checked that folder for files that weren't there before? ;)
 
Upvote 0
Here is the process that I used:

1) I recorded and stopped a new Macro. Then I stepped into that macro and erased and copy and pasted the code that you sent to me.

2) I changed cell "A1" to "A2" in your code in this line:
wb.SaveAs ThisWorkbook.Path & ws.Range("A2").Value & ".xls"

3) I ran the macro. A blank page opened and then closed and was saved in a path that was not where the workbook is located.

4) I just checked the path where the main workbook is located and there was no new files created.

Any thoughts?

Thanks in advance!
 
Upvote 0
Okay - use Alt F11 to open the VBA editor (if it's not already open) and find the code that you pasted in. In the blue bar at the very top of the screen it should say something like "Microsoft Visual Basic - Book1 - [Module1 (Code)]".

What does yours say?
 
Upvote 0
Okay, that's your problem - the code needs to be in a standard module in your workbook with 80 sheets, not in your personal macro workbook.

This line:
For Each ws In ThisWorkbook.Worksheets

means that the macro works on whichever book the code is in.
 
Upvote 0

Forum statistics

Threads
1,222,689
Messages
6,167,648
Members
452,127
Latest member
jayneecm

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