find pagebreak

J

Jan Karel Pieterse

Hi Tina,
How do I write code to find a pagebreak

This might give you an idea:

Sub ShowPageBreaksAndRemoveManuals()
Dim oHPgbr As HPageBreak
Dim oVPgbr As VPageBreak
For Each oHPgbr In ActiveSheet.HPageBreaks
If oHPgbr.Location.EntireRow.PageBreak = xlPageBreakManual Then
MsgBox "Manual row page break at:" &
oHPgbr.Location.Address
oHPgbr.Location.EntireRow.PageBreak = xlPageBreakNone
Else
MsgBox "Other row page break at:" & oHPgbr.Location.Address
End If
Next
For Each oVPgbr In ActiveSheet.VPageBreaks
If oVPgbr.Location.EntireColumn.PageBreak = xlPageBreakManual
Then
MsgBox "Manual Column page break at:" &
oVPgbr.Location.Address
oVPgbr.Location.EntireColumn.PageBreak = xlPageBreakNone
Else
MsgBox "Other Column page break at:" &
oVPgbr.Location.Address
End If
Next
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
http://www.jkp-ads.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top