ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Page Break (https://www.excelbanter.com/excel-worksheet-functions/38784-page-break.html)

Sheri

Page Break
 
I need Excel to insert a page break at every blank row. The number of rows
per page will be different each time I run the report, so the row number will
change each time. I have been inserting the page breaks manually, but it is
a very time consuming process with such a long report.
--
Sheri

Ron de Bruin

Hi Sheri

Try this tester
I check all blanks in A1:A20

Sub Insert_PageBreaks()
Dim cell As Range
ActiveSheet.ResetAllPageBreaks
On Error Resume Next
For Each cell In Range("A1:A20").SpecialCells(xlCellTypeBlanks)
ActiveSheet.HPageBreaks.Add Befo=Cells(cell.Row, 1)
Next
On Error GoTo 0
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Sheri" wrote in message ...
I need Excel to insert a page break at every blank row. The number of rows
per page will be different each time I run the report, so the row number will
change each time. I have been inserting the page breaks manually, but it is
a very time consuming process with such a long report.
--
Sheri





All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com