-
Find Out what Page a cell will print on
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
Last edited by jazzyt2u; 12-09-2009 at 06:40 PM.
-
[VBA]
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
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
-
Do you know how to find out what the first cell is on a new page?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules