Here's the basic macro for comparing matches in columns A & B and merging all the column C data into row format.
Sub Consolidate()
'JBeaucaire (9/18/2009)
'Sort/Match column A & B values, merge all other cells into row format
Dim LastRow As Long, NextCol As Long
Dim LastCol As Long, i As Long
Application.ScreenUpdating = False
'Sort data
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("A1").CurrentRegion.Sort Key1:=Range("A1"), Order1:=xlAscending, _
Key2:=Range("B1"), Order2:=xlAscending, Header:=xlGuess
'Group matching names
For i = LastRow To 2 Step -1
If Cells(i, "A").Value = Cells(i - 1, "A").Value And _
Cells(i, "B").Value = Cells(i - 1, "B").Value Then
Range(Cells(i, "C"), Cells(i, Columns.Count).End(xlToLeft)).Copy _
Cells(i - 1, Columns.Count).End(xlToLeft).Offset(0, 1)
Rows(i).EntireRow.Delete (xlShiftUp)
End If
Next i
Cells.Columns.AutoFit
Application.ScreenUpdating = True
End Sub
Bookmarks