ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlpagebreak Property (https://www.excelbanter.com/excel-programming/288946-xlpagebreak-property.html)

Kerry[_4_]

xlpagebreak Property
 
How do I use this property to find the address of automatic page breaks? Excel VBA help doesn't do a great job explaining this one

-Kerry

Rob van Gelder[_4_]

xlpagebreak Property
 
Kerry,

Sub test()
Dim hpb As HPageBreak

For Each hpb In Sheet1.HPageBreaks
If hpb.Type = xlPageBreakAutomatic Then
Debug.Print "Automatic: " & hpb.Location.Address
ElseIf hpb.Type = xlPageBreakManual Then
Debug.Print "Manual: " & hpb.Location.Address
End If
Next
End Sub



Rob

"Kerry" wrote in message
...
How do I use this property to find the address of automatic page breaks?

Excel VBA help doesn't do a great job explaining this one.

-Kerry




Chip Pearson

xlpagebreak Property
 
Kerry,

The Location property of the H/VPageBreak objects returns a Range
object reference to the location of the page break. From that,
you can use the Address property to get the address. The range
returned by Location is immediately below the page break.

Debug.Print ActiveSheet.HPageBreaks(1).Location.Address


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Kerry" wrote in message
...
How do I use this property to find the address of automatic

page breaks? Excel VBA help doesn't do a great job explaining
this one.

-Kerry





All times are GMT +1. The time now is 03:33 PM.

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