1. Sub main()
    2. Application.DisplayAlerts = False
    3. Dim i, j, k
    4. For i = 1 To 9999
    5. If Cells(i + 1, 1) = Cells(i, 1) Then
    6. For j = 2 To 999
    7. If Cells(i + j, 1) <> Cells(i, 1) Then
    8. For k = 1 To 4
    9. Range(Cells(i, k), Cells(i + j - 1, k)).Select
    10. With Selection
    11. .HorizontalAlignment = xlCenter
    12. .VerticalAlignment = xlCenter
    13. .WrapText = False
    14. .Orientation = 0
    15. .AddIndent = False
    16. .IndentLevel = 0
    17. .ShrinkToFit = False
    18. .ReadingOrder = xlContext
    19. .MergeCells = False
    20. End With
    21. Selection.Merge
    22. Next k
    23. Exit For
    24. End If
    25. Next j
    26. End If
    27. Next i
    28. Application.DisplayAlerts = True