Forum Discussion
gkilar
Dec 08, 2021Copper Contributor
Merge Rows with same name but different data
 Good Afternoon,     I have a long spreadsheet that was exported from an aging software.  Each customer has a different record for each form of contact.  I need to merge all several thousand of these ...
HansVogelaar
Dec 08, 2021MVP
Another option:
Sub CombineRows()
    Dim m As Long
    Dim r As Long
    Dim c As Long
    Application.ScreenUpdating = False
    m = Cells(Rows.Count, 1).End(xlUp).Row
    r = 2
    Do
        Do While Cells(r + 1, 1).Value = Cells(r, 1).Value
            For c = 4 To 8
                If Cells(r + 1, c).Value <> "" Then
                    Cells(r + 1, c).Copy Destination:=Cells(r, c)
                End If
            Next c
            Cells(r + 1, 1).EntireRow.Delete
        Loop
        r = r + 1
    Loop Until Cells(r, 1).Value = ""
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub