Try this:
Sub Merge_Similar_Cells()
Dim WorkRng As Range
Dim Rng As Range
Dim xRows As Integer
Dim I As Integer
Dim J As Integer, b As Boolean, K As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set WorkRng = Range("A2:C" & Cells(Rows.Count, 1).End(xlUp).Row)
xRows = WorkRng.Rows.Count
For Each Rng In WorkRng.Columns
For I = 1 To xRows - 1
For J = I + 1 To xRows
b = False
For K = Rng.Column To 1 Step -1
If Rng.Cells(I, 1).Offset(, K - Rng.Column).MergeArea.Cells(1, 1).Value <> Rng.Cells(J, 1).Offset(, K - Rng.Column).MergeArea.Cells(1, 1).Value Then b = True
Next
If b Then Exit For
Next J
WorkRng.Parent.Range(Rng.Cells(I, 1), Rng.Cells(J - 1, 1)).Merge
I = J - 1
Next I
Next Rng
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks