View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ardus Petus Ardus Petus is offline
external usenet poster
 
Posts: 718
Default insert page break

Try this:

HTH
--
AP

'---------------
Sub InsertPB()
Dim rTotal As Range
Dim sFirstFound As String
With ActiveSheet
Set rTotal = .UsedRange.Find( _
what:="Total", _
lookat:=xlWhole)
If Not rTotal Is Nothing Then
sFirstFound = rTotal.Address
Do
.HPageBreaks.Add befo=rTotal.Offset(1, 0)
Set rTotal = .UsedRange.FindNext(after:=rTotal)
Loop Until rTotal.Address = sFirstFound
End If
End With
End Sub
'---------------
"ruben via OfficeKB.com" <u21729@uwe a écrit dans le message de news:
6012de74a9ca8@uwe...
Hi all,

I have an excel sheet where hundreds of invoices are found and would like
to
insert page breaks after the word 'Total' is being displayed. Is that
possible?

Thks in advance

--
Message posted via http://www.officekb.com