Try this
Because I can't determine where your sheet ends, put some text in Column A in the last row + 1 that you need merged anything will do e.g. "Stop"
Then run this macro
Option Explicit
Sub MergeAndCenterColumn()
Dim LastRow As Long, RowNo As Long, StartRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For RowNo = 2 To LastRow
If Cells(RowNo, "A") <> "" Then StartRow = Cells(RowNo, "A").Row
If Cells(RowNo, "A") = "" And Cells(RowNo + 1, "A") <> "" Then
With Range(Cells(StartRow, "A"), Cells(RowNo, "A"))
.MergeCells = True
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.BorderAround LineStyle:=xlContinuous, Weight:=xlThick
End With
Range(Cells(StartRow, "A"), Cells(RowNo, "J")).BorderAround LineStyle:=xlContinuous, Weight:=xlThick
End If
Next
End Sub
If you don't define this last row, (effectively the next set to merge), the code will not format your last data group.
Hope this helps.
Bookmarks