View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default Fixing Page Breaks

Whoa! 300 pages!! That's a lot of printing!! Save the trees!!

Not sure why you are losing those PageBreaks, but try this to get those page
breaks in faster:

Sub Insert_PBreak()
Dim OldVal As String
Dim rng As Range
OldVal = "YourCriteria"
For Each rng In Range("A1:A300") '<< change range
If rng.Text = OldVal Then
rng.Offset(1, 0).pagebreak = xlPageBreakManual
End If
Next rng
End Sub


Sub pagebreak()
Dim value1 As String
Dim value2 As String
Range("A2").Select
Do While ActiveCell.Value < ""
value1 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
value2 = ActiveCell.Value
If value1 < value2 Then
ActiveCell.EntireRow.Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell
Else
End If
Loop
End Sub

Than, when you are done, view it on your monitor and resist the urge to
click that print button!!

Regards,
Ryan--

--
RyGuy


"vic1" wrote:

I have a Workbook split into 26 alphabetical worksheets, each of which prints
out as several pages (300+ when the whole workbook is printed.)

I insert page breaks at the appropriate points and as long as I print there
and then, it is OK. However, if I save and close then reopen, the page breaks
have slipped and no longer 'break' in the right places - so they all have to
be set again, which is fairly time consuming on 300 pages!

Is there any means of fixing them so this does not happen?