What is the location of my first horizontal page break?

C

Claud Balls

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!
 
N

Nick Hodge

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
(e-mail address removed)
 

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