Option Explicit
Sub Reformat()
Dim aryColD() As String
Dim cntColD As Long, i As Long, rowLast As Long, rowLastInBlock As Long
Application.ScreenUpdating = False
With Worksheets("Sheet1")
.ResetAllPageBreaks
rowLast = .Cells(.Rows.Count, 1).End(xlUp).Row
cntColD = 1
ReDim Preserve aryColD(1 To cntColD)
aryColD(cntColD) = 1
For i = 2 To rowLast - 1
If .Cells(i, 4).Value <> .Cells(i + 1, 4).Value Then
cntColD = cntColD + 1
ReDim Preserve aryColD(1 To cntColD)
aryColD(cntColD) = i + 1
End If
Next i
For i = UBound(aryColD) To LBound(aryColD) Step -1
Application.StatusBar = "Processing row " & i
Worksheets("Sheet2").Rows(1).Copy
.Rows(aryColD(i)).Insert Shift:=xlDown
.Rows(aryColD(i)).Insert Shift:=xlDown
.Cells(aryColD(i), 1).Value = .Cells(aryColD(i) + 2, 4).Value
.Cells(aryColD(i), 1).Font.Bold = True
rowLastInBlock = .Cells(aryColD(i), 1).End(xlDown).Row
With .Cells(aryColD(i) + 1, 1).Resize(rowLastInBlock - aryColD(i), 7).Borders
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
If aryColD(i) > 1 Then .HPageBreaks.Add Before:=.Rows(aryColD(i))
Next i
End With
Application.StatusBar = False
Application.ScreenUpdating = True
MsgBox "Done"
End Sub