Macro needed - Rows with matching x criteria in a column need to be copied onto a sheet labeled x

sniperdoc

New Member
Joined
Dec 31, 2018
Messages
2
I have limited experience with macros, I know how to execute them... that's about it.

I have a large csv file that has data arranged like this (with over 2000 rows):

groupnametypeactivetitledept
onejohn smithuseryesderpderp2
onejane doeuseryesderpityderpderp
onejimmy johnsuseryesderperderpderp2
twojohn smithuseryesderpderp2
twohildegarduseryesderpityderpderp
threejohn smithuseryesderpderp2

<tbody>
</tbody>

I am trying to find an easy way to get sheets created for each group, and then copy each user matching that group to the new sheet.

I found a macro to create the sheets for each group, but I have not found a way to copy rows via matching criteria to those sheets... at least not in one click. I can probably find something that I can run for each group, but I have almost 100 groups... so, I'd like something that can copy all the data with one run of the macro... :(

Any assistance is appreciated.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Soooo, what is the criteria we have to match ???
 
Upvote 0
Soooo, what is the criteria we have to match ???
Hey Michael, sorry about that. It should be the Groups that should be the criteria.

Essentially every record that lists group one, should be on placed a new sheet labeled "group one", group two onto "group two" sheet, such and so forth.

But, you may want to hold off. I may have found something to help me do what I need to do without needing the extra sheets.
 
Upvote 0
Maybe something like this..
If you post the sheet creation code, I'll merge it into this code for you

Code:
Sub MM1()
Dim r As Long, lr1 As Long, lr2 As Long
Application.ScreenUpdating = False
lr = Sheets("Master").Cells(Rows.Count, "B").End(xlUp).Row 'Chnage Master sheet to main sheet name
For r = 2 To lr
    With Sheets(Cells(r, "A").Value)
        If .Range("A1") = "" Then
            lr2 = 1
        Else
            lr2 = .Cells(Rows.Count, "A").End(xlUp).Row + 1
        End If
        Rows(r).Copy .Cells(lr2, "A")
    End With
Next r
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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