Macro - C&P into new tabs, depending on change in cell

CRMTHB

New Member
Joined
Mar 12, 2019
Messages
13
Hi,

I have a worksheet (sheet1) which I want to split out into new tabs, depending on what is in cell T2. So if Apples is in T2, T4, T28 etc, I want all those rows, plus row 1 to be copied and pasted into a new tab, called Apples.

However, I only want selected data to be moved - so rows with apples and bananas split into their own tabs, but not pears, lemon, mangos, oranges etc.

There would be more instances which I do not want to be copied, so it'd be easier if I listed those to be included, rather than list those to be excluded

Can this be done?

Thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
So if you select T23 and it has Alpha and you select T34 and it has Bravo and if you select T45 and it has Charlie the script will need to create three new sheets named Alpha Bravo and Charlie and copy the rows to those sheets.

So some how the script will need to know if those three sheets already exist.
And if not create them and copy the rows to those sheets.
Is that what your wanting?
 
Upvote 0
So if you select T23 and it has Alpha and you select T34 and it has Bravo and if you select T45 and it has Charlie the script will need to create three new sheets named Alpha Bravo and Charlie and copy the rows to those sheets.

So some how the script will need to know if those three sheets already exist.
And if not create them and copy the rows to those sheets.
Is that what your wanting?

Yes, that's correct. All the tabs will need to be created as new, none of them exist at the moment
 
Upvote 0
Thanks for that answer. I may need to let someone else help you. As if you select two cells with the same sheet name the script would have to create a new sheet the first time but not the second time.
And I'm not good at checking if sheet exist.
This is beyond my knowledgebase.
I will continue to monitor this thread to see what I can learn.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,874
Members
449,056
Latest member
ruhulaminappu

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