Insert page breaks every 50 rows but do not include hidden row
Thank you so much!
--
Regards,
Martin
"Gary''s Student" wrote:
Sub pformt()
k = 0
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
nFirstRow = r.Row
For n = nFirstRow To nLastRow
If Cells(n, "A").EntireRow.Hidden Then
Else
k = k + 1
End If
If k = 51 Then
k = 1
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=Cells(n, "A")
End If
Next
End Sub
--
Gary's Student
gsnu200710
"Martin" wrote:
Hi there,
Is there a method to put page breaks in the used range every 50 rows but
exclude any hidden rows in the count of rows.
Example: a sheet with 200 rows of data and row 25 to 39 and 50 to 74 are
hidden. The first page break should then appear at row 90 and the second one
at row 140 etc.
Any help much appreciated.
--
Regards,
Martin
|