Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 2 of 2

Thread: Return row where page break occurs

  1. #1
    Join Date
    7th June 2006
    Posts
    10

    Return row where page break occurs

    Hello,

    I want to find, with vba, which row a page break occurs. I am formatting some worksheets and each one will have a different number of rows on the first page due to the fact that I'm autofitting rows. For example, in one sheet, the first page may end at line 40, while on a different sheet it may end on 36 due to text wrapping and autofit. I simply need help storing the row number into a variable and I can take it from there.

    thanks,

    Scott

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    24th January 2003
    Location
    Australia
    Posts
    31,784

    Re: Return row where page break occurs

    Hi Scott

    This should get you there
    Code:
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Remove Page Numbers In Page Break Preview
    By simp in forum EXCEL HELP
    Replies: 3
    Last Post: May 18th, 2007, 20:11
  2. Remove Page Numbers From Page Break Preview
    By bkb in forum EXCEL HELP
    Replies: 1
    Last Post: September 10th, 2006, 15:25
  3. Add time to work schedule when break occurs
    By jacobwarren in forum EXCEL HELP
    Replies: 6
    Last Post: August 15th, 2006, 19:02
  4. Replies: 1
    Last Post: May 20th, 2006, 12:17
  5. Page Break Preview - Turning Off Page Indicator
    By nodnerb in forum EXCEL HELP
    Replies: 1
    Last Post: October 31st, 2005, 13:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
porno