View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Insert page break


Sub dopagbreaks()
ActiveSheet.ResetAllPageBreaks

With Range("c1:c500")
Set c = .Find("Break", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
ActiveSheet.HPageBreaks.Add Befo=Rows(c.Row)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub



On Oct 14, 12:28*pm, Norvascom wrote:
Hi,

I have a long report with several lines on worksheet "Sheet1".
I would like to have a code that would insert a page break every time
there is the word "Break" on column C.
Note that the page break would be just above the line indicating
"Break".

Thanks in advance for your help.