Sub main()Application.DisplayAlerts = FalseDim i, j, kFor i = 1 To 9999 If Cells(i + 1, 1) = Cells(i, 1) Then For j = 2 To 999 If Cells(i + j, 1) <> Cells(i, 1) Then For k = 1 To 4 Range(Cells(i, k), Cells(i + j - 1, k)).Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge Next k Exit For End If Next j End IfNext iApplication.DisplayAlerts = True