Option Explicit
Option Base 1
'123456789012345678901234567890123456h8nor@ya567890123456789012345678toster56789
Sub Merge_by_Rows() ' Без форматирования границ
Dim i As Integer, j As Integer, cnt As Integer
Dim arr() As Variant, s As String
With ActiveSheet.UsedRange ' Кол-во столбцов определяется по 1-й строке
arr = Range(Cells(1, 1), Cells(.Rows.Count + 1, Range("A1").End(xlToRight).Column))
End With
cnt = 1: s = get_Row(arr, cnt)
For i = LBound(arr, 1) + 1 To UBound(arr, 1)
If get_Row(arr, i) <> s Then
For j = LBound(arr, 2) To UBound(arr, 2)
With ActiveSheet.Range(Cells(cnt, j), Cells(i - 1, j)).Offset(, UBound(arr, 2))
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Value = arr(cnt, j)
End With
Next j
cnt = i: s = get_Row(arr, cnt)
End If
Next i
End Sub
Function get_Row(ByVal arr As Variant, ByVal num_Row As Integer) As String
Dim j As Integer
For j = LBound(arr, 2) To UBound(arr, 2)
get_Row = WorksheetFunction.Trim(get_Row & " " & arr(num_Row, j))
Next j
End Function
Процедуру выполнять на активном листе.