MrExcel Consulting
Your One Stop for Excel Tips & Solutions

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

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

Posted by Sophia on September 10, 0100 11:00 AM

thank you for the quick reply

I will try out your ideas today