![]() |
how to automatically add page breaks?
Is there a way to either write a macro or something else so that each time a
certain word appears (total) a page break inserts? It's a long report that I need to print each totaled group on a separate page. It would be great if I could somehow get the page breaks in without having to add each one manually. |
how to automatically add page breaks?
Try this code. It searches column A for the word Add and puts a page break
after the row with the word ADD ActiveSheet.ResetAllPageBreaks LastRow = ActiveSheet.Cells. _ SpecialCells(Type:=xlCellTypeLastCell).Row For RowCount = 1 To LastRow If Range("A" & RowCount) = "Add" Then ActiveSheet.HPageBreaks.Add _ befo=Rows(RowCount + 1) End If Next RowCount "mcie2" wrote: Is there a way to either write a macro or something else so that each time a certain word appears (total) a page break inserts? It's a long report that I need to print each totaled group on a separate page. It would be great if I could somehow get the page breaks in without having to add each one manually. |
All times are GMT +1. The time now is 07:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com