VBA to separate specific Tabs into separate workbooks

redneckopen

Board Regular
Joined
Nov 2, 2004
Messages
224
How would I separate tabs into different workbook (no need to save at this point) by the first four characters of the Tab name using VBA?

example; Canada, Chile, Colombia, would be separated by cana, chil, colo. There is additional information on each tab but these would be leading.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Now I am getting a run-time error 'This extension can not be used with the selected file' when I name the sheet
 
Upvote 0
Whichever you want the extension to be. Only put the actual name of the file in the input box. The code will automatically add whichever extension you put in that line of code. It is a new book with no VBA in it so you should be able to save as an xlsx (providing you are running Excel 2007 or higher)...
 
Upvote 0
So after trying the .xlsx with the same error I changed to .xlsm and it worked once then asked me to name the workbook which I did and then it stopped the process. When I opened the file that was saved it just copied the (Master)first tab 69 times along with still having all of the other individual tabs.
 
Upvote 0
I don't know what to tell you. The code tested fine for me with a mock up of what I believed your data to look like. If you want to paste a graphical representation of what you have or email me a copy of something that is similar to your workbook, then feel free to PM me and I will give you my email address.
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

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