Anyway to detect a new page

  • Thread starter Thread starter NateBuckley
  • Start date Start date
N

NateBuckley

Hello I'd like someway to figure out if my loop ends up on a new page, and I
was wondering if there was a check to see if something is on a different page?

For example I was thinking of something along the lines:
dim pageAt as Integer
pageAt = Sheet1.Cells(10, 1).Row.PageOn

for i = 10 to 200
if Sheet1.Cells(i, 1).Row.PageOn <> pageAt then
MsgBox("New Page")
pageAt = Sheet1.Cells(i, 1).Row.PageOn
end if

I know there is no PageOn method/property etc but is there anything like
that?
Thanks for anyone who can throw some advice my way.

Nate
next i
 
found = false
for i = 10 to 200
if Sheet1.Cells(i, 1).Row.PageOn <> pageAt then
MsgBox("New Page")
pageAt = Sheet1.Cells(i, 1).Row.PageOn
Found = true
exit for
end if
next i
if found = true then
MsgBox("added new Page")
end if
 
Sorry I may have not been clear, but i mentioned there is no "PageOn"
property of Row, the code I posted was just an example of something I'd like
to do.

I was just wondering if anyone knew of a property that is like the made up
PageOn that I simply can't find.

Thanks for your post though.
 
When I want to check if a page exists I do the following

NewSheet = "ABC"
Found = False
for each sht in thisworkbook.sheets
if sht.name = NewSheet then
Found = false
exit for
end if
next sht
if Found = False then
msgbox("Sheet doesn't exist")
else
msgbox("Found Sheet")
end if
 
NateBuckley said:
Sorry I may have not been clear, but i mentioned there is no "PageOn"
property of Row, the code I posted was just an example of something I'd like
to do.

I was just wondering if anyone knew of a property that is like the made up
PageOn that I simply can't find.


Maybe you could use Worksheet.HPageBreaks and Worksheet.VPageBreaks
 

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

Back
Top