Grouping Rows
Hi,
This assumes name in Col A, choice in column B:
Sub matchup()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lastrow As Long, r As Long
Dim row As Variant
Set ws1 = Worksheets("sheet1") ' <=== change sheet names as required
Set ws2 = Worksheets("sheet2")
With ws1
lastrow = .Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lastrow '<=== assumes data starts in row 2
Row = Application.Match(.Cells(r, "B"), ws2.Range("A:A"), 0)
If Not IsError(Row) Then
ws2.Cells(Row, "A").Offset(1, 0).EntireRow.Insert
ws2.Cells(Row + 1, "A") = .Cells(r, "A")
End If
Next r
End With
HTH
"Justin Philips" wrote:
Here is my situation:
I have a list of entries that i need to group according to their choice
so i get a list of people
Justin "choice1"
Sharon "choice2"
Marisa "choice3"
Joe "choice2"
John "choice3"
etc...
I have another sheet set up like this
choice1
choice2
choice3
choice4
....
i need to copy the cells from sheet 1 to sheet to so it ends up like
this
choice1
Justin
choice2
Sharon
Joe
choice3
Marisa
John
choice4
....
5
....
Can anyone help in this. I can post code but there is more to my
current code than what i am asking for here...i just need a place to
start.
Thanks,
Justin
|