ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find pagebreak (https://www.excelbanter.com/excel-programming/332082-find-pagebreak.html)

tina

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

Jan Karel Pieterse

find pagebreak
 
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



All times are GMT +1. The time now is 07:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com