Create and fill worksheet of unique combination of 2 cells

tiffanyle

New Member
Joined
Sep 12, 2019
Messages
1
Hi,

I'm having an issue with making a macro that creates a new worksheet for every unique combination of 2 columns
(Category and procedure). All the worksheet will then have a "form" with all the columns related to that combination.

Is there anybody that can help me?

Thank you.
17FPjpy

pb60VCF
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hello,

Have assumed you are using Columns A and B for the combinations

Code:
Sub create_sheets()
    MY_SOURCE = ActiveSheet.Name
    For MY_ROWS = 2 To Range("A" & Rows.Count).End(xlUp).Row
        Range("Z" & MY_ROWS).Value = Range("A" & MY_ROWS).Value & Range("B" & MY_ROWS).Value
    Next MY_ROWS
    Range("Z1").Value = "TAB"
    Range("Z1:Z5").AutoFilter
    Range("Z1:Z5").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
        "AA1"), Unique:=True
    For MY_SHEETS = 2 To Range("AA" & Rows.Count).End(xlUp).Row
        Sheets.Add After:=Sheets(Sheets.Count)
        ActiveSheet.Name = Sheets(MY_SOURCE).Range("AA" & MY_SHEETS).Value
    Next MY_SHEETS
    Sheets(MY_SOURCE).Select
    Columns("Z:AA").ClearContents
End Sub

Is this close to your requirements?
 
Upvote 0

Forum statistics

Threads
1,213,563
Messages
6,114,329
Members
448,564
Latest member
ED38

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