W
w0wzers
I found this macro
Option Explicit
Sub testme()
Dim wks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Set wks = ActiveSheet
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value
Then
.Range(.Cells(iRow, "B"), _
.Cells(iRow,
..Columns.Count).End(xlToLeft)).Copy _
Destination:=.Cells(iRow - 1, .Columns.Count) _
.End(xlToLeft).Offset(0, 1)
.Rows(iRow).Delete
End If
Next iRow
End With
End Sub
which combines the duplicate rows but adds the duplicate data into new
columns
I need it to add the data to the existing columns
the code right now does:
ex. Column A|Column B|Column C|Column D
1 Book Dog Pen
1 Bag Cat Pencil
After the macro:
Column A|Column B|Column C|Column D|Column E|Column F|Column G|
1 Book Dog Pen Bag
Cat Pencil
I need it to be:
Column A|Column B|Column C|Column D
1 Book,Bag| Dog,Cat| Pen,Pencil
Can any help? Please I have like 17000 records i need this for
Thank to all, Especially Dave Peterson for writing that macro
Option Explicit
Sub testme()
Dim wks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Set wks = ActiveSheet
With wks
FirstRow = 1
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = LastRow To FirstRow + 1 Step -1
If .Cells(iRow, "A").Value = .Cells(iRow - 1, "A").Value
Then
.Range(.Cells(iRow, "B"), _
.Cells(iRow,
..Columns.Count).End(xlToLeft)).Copy _
Destination:=.Cells(iRow - 1, .Columns.Count) _
.End(xlToLeft).Offset(0, 1)
.Rows(iRow).Delete
End If
Next iRow
End With
End Sub
which combines the duplicate rows but adds the duplicate data into new
columns
I need it to add the data to the existing columns
the code right now does:
ex. Column A|Column B|Column C|Column D
1 Book Dog Pen
1 Bag Cat Pencil
After the macro:
Column A|Column B|Column C|Column D|Column E|Column F|Column G|
1 Book Dog Pen Bag
Cat Pencil
I need it to be:
Column A|Column B|Column C|Column D
1 Book,Bag| Dog,Cat| Pen,Pencil
Can any help? Please I have like 17000 records i need this for
Thank to all, Especially Dave Peterson for writing that macro