Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Property returning page number of a cell?

Status
Not open for further replies.

Sashanan2

Programmer
Jul 2, 2004
39
NL
For my current VB/Excel application I could use a way to figure out which page (under the current print settings) a specific cell is on. Is there a property I could query for this? I've gone through the Object Browser a bit but wasn't able to find what I'm looking for.

I initially had a solution in mind where I'd just base it on the row number as my printout is always A4 portrait, so that the number of rows would be constant for each page. But that fell through when I was forced to introduce rows with variable heights. Any suggestions for how else I can do this if there's not just a simple property for it?
 
You would have to iterate through the horizontal pagebreaks collection, checking the LOCATION property, getting the ROW from that and checking it against the ROW your CELL is on

Rgds, Geoff

"Three things are certain: Death, taxes and lost data. Guess which has occurred"

Please read FAQ222-2244 before you ask a question
 


Check out How to find TOTAL NUMBER OF PRINT PAGES in VBA faq707-4390

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Thanks! Managed to work it out by combining your advice. The routine I'm using is crude to say the least (for one thing, it involves GOTOs), but it works, and does everything the customer wanted. Can worry about rewriting it properly when it's time for the second version.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top