Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / May 2008

Tip: Looking for answers? Try searching our database.

how to automatically add page breaks?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mcie2 - 17 May 2008 22:59 GMT
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.
Joel - 18 May 2008 00:04 GMT
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 _
              before:=Rows(RowCount + 1)
  End If
Next RowCount

> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.