ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What is the location of my first horizontal page break? (https://www.excelbanter.com/excel-programming/321010-what-location-my-first-horizontal-page-break.html)

Claud Balls

What is the location of my first horizontal page break?
 
I have a macro that inserts lines to keep text together, so that a
paragraph does not get split between two pages. It works when I hard
code the number of line per page, but I have the fit to one page wide
property set, so that number changes. Is there a way I can find out
what row contains the first horizonal page break?



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nick Hodge

What is the location of my first horizontal page break?
 
Claud

More checking may be necessary to check you have one to avoid a 'subscript
out of range error 9'

Sub FindHPageBreak()
Dim wks As Worksheet
Dim lRow As Long
Set wks = ActiveSheet
lRow = wks.HPageBreaks(1).Location.Row
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Claud Balls" wrote in message
...
I have a macro that inserts lines to keep text together, so that a
paragraph does not get split between two pages. It works when I hard
code the number of line per page, but I have the fit to one page wide
property set, so that number changes. Is there a way I can find out
what row contains the first horizonal page break?



*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 11:14 AM.

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