Select the range of cells to evaluate in the first column then run this macro:
Option Explicit
Sub CountVisibleMergedSectionsAddPageBreaks()
'Select the range of rows to evaluate in the first column then run this macro
Dim RNG As Range: Set RNG = Selection
Dim MyRow As Long: MyRow = 1
Dim BrCount As Long
Do
If RNG.Cells(MyRow).EntireRow.Hidden = False Then
MyRow = MyRow + RNG.Cells(MyRow).MergeArea.Rows.Count
If MyRow > RNG.Rows.Count Then Exit Do
BrCount = BrCount + 1
If BrCount = 13 Then
ActiveWindow.SelectedSheets.HPageBreaks.Add _
Before:=RNG.Cells(MyRow)
BrCount = 0
End If
Else
MyRow = MyRow + RNG.Cells(MyRow).MergeArea.Rows.Count
End If
Loop
Set RNG = Nothing
End Sub
Bookmarks