PDA

View Full Version : Solved: Find Out what Page a cell will print on



jazzyt2u
12-09-2009, 04:44 PM
Hi,

What code would I use to find out what page a cell (using activecell) I have selected will print on?

I have two sections of data and if the first part of the data doesn't go down to page two I don't need its headers. If it does I will need the headers so I need to know a way to determine when and if the first set of data goes to page two or greater.


Thanks,
Tasha

mdmackillop
12-09-2009, 05:31 PM
Sub Check_PageBreak()
Dim i As Integer, x as Integer, BreakType As Integer
For i = 2 To ActiveCell.Row
BreakType = Cells(i, 1).EntireRow.PageBreak
If BreakType = xlAutomatic Or BreakType = xlManual Then x = x + 1
Next
MsgBox "your cell is on page " & x + 1
End Sub

jazzyt2u
12-09-2009, 05:41 PM
Thank you VERY much!!!!

jazzyt2u
12-09-2009, 06:39 PM
Do you know how to find out what the first cell is on a new page?