To determine that cell is on top of page

  • Thread starter Andrei Zakharov
  • Start date
A

Andrei Zakharov

Hi,

Is there a way to determine that the cell is on the top of the page, e.g. in
Page Break Preview?
Thank you.
 
R

Rick Rothstein

I think this function will do what you want...

Function IsTopOfPage(SheetName As String, RowNumber As Long) As Boolean
With Worksheets(SheetName)
IsTopOfPage = .Rows(RowNumber).PageBreak <> xlPageBreakNone
End With
End Function

Just pass it the name of worksheet (as a String value) and the row number of
the cell you want to check and it will return True if that cell is located
on the top row of a page.
 

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