Try this code:
Sub Merge_cells()
Dim C_ell As Range
For Each C_ell In Range("A1", Cells(Rows.Count, 1).End(xlUp))
If C_ell.Value = C_ell.Offset(0, 1).Value Then
C_ell.Offset(0, 1).Value = ""
Range(C_ell, C_ell.Offset(0, 1)).Select
Selection.Merge
End If
Next
End Sub
You can change the range the macro looks at by replacing "A1" by the address of the upper left cell of your data and do not forget to also change the number 1 in Cells(Rows.Count,1) portion of the code with the first column number of your data.
Regards
Pierre
Bookmarks