Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to merge data in several columns to one row, for example.
Col 'A' Col 'B' Col 'C' Col 'D' Col 'E' Joe 10/1/08 Joe 10/2/08 Joe 10/3/08 Kim 10/2/08 Kim 10/1/08 John 10/1/08 John 10/2/08 John 10/3/08 John 10/4/08 The Output should look like this: Col 'A' Col 'B' Col 'C' Col 'D' Col 'E' Joe 10/1/08 10/2/08 10/3/08 Kim 10/1/08 10/2/08 John 10/1/08 10/2/08 10/3/08 10/4/08 I have the following macro but it does not seem to work completely right. It does some merging but leaves some duplicate names - wondered if anyone could help? Sub Remove_Duplicate() Dim LASTROW As Long Dim I As Long Dim J As Long Dim K As Long Dim MyVALUE As Variant Application.ScreenUpdating = False LASTROW = Range("A" & Rows.Count).End(xlUp).Row For I = 1 To LASTROW - 1 MyVALUE = Cells(I, "C") & Cells(I, "D") For J = I + 1 To LASTROW If (MyVALUE = Cells(J, "D") & Cells(J, "E")) Then For K = 1 To 13 If (Cells(I, K) = "") Then Cells(I, K) = Cells(J, K) Next K Cells(J, "A").EntireRow.Delete End If Next J Next I Application.ScreenUpdating = True ' End Sub -- Jake |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Merging rows | Excel Programming | |||
Is merging rows possible? | Excel Worksheet Functions | |||
Merging rows | New Users to Excel | |||
Merging Two Rows Into One | Excel Worksheet Functions | |||
Merging a number of rows | Excel Programming |