Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How would i make it so that entire row from sheet1 is inserted instead
of just the one cell? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If Not IsError(Row) Then ws2.Cells(Row, "A").Offset(1, 0).EntireRow.Insert .Cells(r, "A").EntireRow.Copy ws2.Cells(Row + 1, "A") '<=== amended code End If "Toppers" wrote: 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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks it works!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Grouping Rows | Excel Worksheet Functions | |||
grouping rows | Excel Discussion (Misc queries) | |||
grouping rows... | New Users to Excel | |||
Grouping Rows | Excel Discussion (Misc queries) | |||
Grouping rows together | Excel Worksheet Functions |