Creating a new tab for each unique cell and copying rows that match the cell?

juggin95

New Member
Joined
Jan 21, 2022
Messages
3
Office Version
  1. 2021
Platform
  1. Windows
See example Master spreadsheet:


I would like to create a new tab for each unique item in column (A) (i.e. new tab for 'AGHT', 'AJDI', 'ASTRO', etc).

I would then like to group all the rows that match in column A and move them (with columns B, C and D) to their respective new tab created. So all the rows that have 'Astro' in column A and move them tot he tab names 'Astro'

One solution I've worked on that works great is a macro that creates a new tab for each unique field in column A. See code below:
Sub CreateSheets()

Dim rng As Range

Dim cell As Range

On Error GoTo Errorhandling

Set rng = Application.InputBox(Prompt:="Select cell range:", _

Title:="Create sheets", _

Default:=Selection.Address, Type:=8)

For Each cell In rng

If cell <> "" Then

Sheets.Add.Name = cell

End If

Next cell

Errorhandling:

End Sub


What I am having trouble with is copying all the rows that match what's in column A and moving them to their new respective tab.

Or is there a better way of doing this rather than the solution I've started working on?

Also would this be able to update new tabs and move new rows as the master spreadsheet is updated?
 

Attachments

  • image001 (1).png
    image001 (1).png
    208.3 KB · Views: 18

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Creating a new tab for each unique cell and copying rows that match the cell?
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Creating a new tab for each unique cell and copying rows that match the cell?
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
Apologies, noted for future posts.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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