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