Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

is it possible to find out which row a page break is on using code

Posted by Sophia on September 10, 2000 1:26 AM
I have a major problem with my spreadsheet when it is loaded on other computers. I have set a VBA routine to create a single, consolidated print sheet out of multiple sheets of information. I am trying to figure out a way of knowing how many rows will print on a page for any given computer that I load the spreadsheet on. It wouldn't be a big deal if the margins weren't miss-behaving everytime I load it on a different computer. Maybe I am missing something, but I am settin the margins programmatically using the inchesToPoints method. I would have thought that that would standardize it, but it doesn't. One computer will have 42 rows per page and another might have 47 etc.

I hope this makes sense and someone has some ideas on my problem.

Thank you,

Sophia


Check out our Excel VBA Resources

Re: is it possible to find out which row a page break is on using code

Posted by Ivan Moala on September 10, 0100 2:24 AM

Sophia

To get the number of rows try this

Dim RowsPrted As Integer
RowsPrted = ExecuteExcel4Macro("GET.DOCUMENT(64)") - 1


Using the VBA equavalent
= ActiveSheet.HPageBreaks.location.address

can yeild diff results ?!


HTH


Ivan


thank you for the quick reply

Posted by Sophia on September 10, 0100 11:00 AM
I will try out your ideas today

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.