Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's some code for it
Sub test() Dim cLastRow As Long Dim i As Long Dim j As Long Dim rng As Range cLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = 2 To cLastRow j = 0 Do While Cells(i, "C").Value = Cells(i + j + 1, "C").Value j = j + 1 Cells(i + j, "A").Resize(1, 5).Copy Cells(i, 5 * j + 1) If rng Is Nothing Then Set rng = Cells(i + j, "A") Else Set rng = Union(rng, Cells(i + j, "A")) End If Loop i = i + j Next i If Not rng Is Nothing Then rng.EntireRow.Delete End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "psinta" wrote in message ... Yes and there more than 3 row. I just put 3 here as an example. Thanks for your help. -----Original Message----- What are the rules? Do you want 5 cells for row 1, followed by the 5 for row 2, etc.? And are there more rows or just 3? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "psinta" wrote in message ... Help, is there a way to write a code to make these three row of data into one row: Label Grade Teacher FirstName LastName 2015 05 Booney Juan Alva 2018 05 Booney Bailey Bol 2021 05 Booney Ryan Dame Thank you in advance. . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you, thank you. I'm sorry to get back to you so
late, got busy at work. -----Original Message----- Here's some code for it Sub test() Dim cLastRow As Long Dim i As Long Dim j As Long Dim rng As Range cLastRow = Cells(Rows.Count, "A").End(xlUp).Row For i = 2 To cLastRow j = 0 Do While Cells(i, "C").Value = Cells(i + j + 1, "C").Value j = j + 1 Cells(i + j, "A").Resize(1, 5).Copy Cells(i, 5 * j + 1) If rng Is Nothing Then Set rng = Cells(i + j, "A") Else Set rng = Union(rng, Cells(i + j, "A")) End If Loop i = i + j Next i If Not rng Is Nothing Then rng.EntireRow.Delete End If End Sub -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "psinta" wrote in message ... Yes and there more than 3 row. I just put 3 here as an example. Thanks for your help. -----Original Message----- What are the rules? Do you want 5 cells for row 1, followed by the 5 for row 2, etc.? And are there more rows or just 3? -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "psinta" wrote in message ... Help, is there a way to write a code to make these three row of data into one row: Label Grade Teacher FirstName LastName 2015 05 Booney Juan Alva 2018 05 Booney Bailey Bol 2021 05 Booney Ryan Dame Thank you in advance. . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Convert a Number Code to a Text Code | Excel Discussion (Misc queries) | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming |