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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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,224,820
Messages
6,181,157
Members
453,021
Latest member
Justyna P

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