PDA

View Full Version : Can VBA determine the first row number of each page?



stanhilliard
10-04-2021, 07:33 PM
Can VBA determine the first row number of each page of a long sheet?

Excel 2016

jolivanes
10-04-2021, 11:06 PM
By Dave Hawley (RIP)

Sub GetPageBreaksRows()
Dim hPB As HPageBreak
Dim lRow As Long
If ActiveSheet.HPageBreaks.Count > 0 Then
For Each hPB In ActiveSheet.HPageBreaks
lRow = hPB.Location.Row
MsgBox lRow
Next hPB
End If

End Sub

stanhilliard
10-07-2021, 12:34 PM
Thanks :)

jolivanes
10-07-2021, 01:01 PM
You're welcome