View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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.