ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting page breaks (another) (https://www.excelbanter.com/excel-programming/325401-setting-page-breaks-another.html)

Ian W[_2_]

Setting page breaks (another)
 
Hello group,

Need a little help with this as my Excel skills are a little rusty.

I have a spreadsheet with repeating blocks of data in three rows.
First row cell 1 spans cols 1-9,
second row cell 1 spans rows 2-3, cell 2 spans cols 2-9
third row,each is (after first is unique, but height of row 3 is variable
There's the occasional header row to skew the count as well
ie:
--------------------------
--|-----------------------
|--|--|--|--|--|--|--|--
--------------------------
--|-----------------------
|--|--|--|--|--|--|--|--

I need to set the page breaks prior to the repeating first row.

How do I find out:
- how many rows fit on a page given the varying row height; ie how many
points on a page (is it screen/printer dependent)?
- how to figure out I'm in a first row

Once I have the answer to the first part,
i think I can
loop through each row,
add the Cells.RowHeight
until over the PointsPerPageLimit
then go back
until the Rows(row).MergeCells is true and Rows(row).MergeArea.Count =9
then ActiveSheet.HPageBreaks.Add befo=Cells (Row, 0)

Does this make sense, and thanks for your help.

Ian.

Tom Ogilvy

Setting page breaks (another)
 
Use automatic pagebreaks to tell you where the next page break is.

force a pagebreak before that.

However, where the pagebreak is will be dependent on the activeprinter. If
you change printers, it could change where the automatic pagebreak falls.

--
Regards,
Tom Ogilvy

"Ian W" <email@ianwllms(at)canada(dot)com wrote in message
...
Hello group,

Need a little help with this as my Excel skills are a little rusty.

I have a spreadsheet with repeating blocks of data in three rows.
First row cell 1 spans cols 1-9,
second row cell 1 spans rows 2-3, cell 2 spans cols 2-9
third row,each is (after first is unique, but height of row 3 is variable
There's the occasional header row to skew the count as well
ie:
--------------------------
--|-----------------------
|--|--|--|--|--|--|--|--
--------------------------
--|-----------------------
|--|--|--|--|--|--|--|--

I need to set the page breaks prior to the repeating first row.

How do I find out:
- how many rows fit on a page given the varying row height; ie how many
points on a page (is it screen/printer dependent)?
- how to figure out I'm in a first row

Once I have the answer to the first part,
i think I can
loop through each row,
add the Cells.RowHeight
until over the PointsPerPageLimit
then go back
until the Rows(row).MergeCells is true and Rows(row).MergeArea.Count =9
then ActiveSheet.HPageBreaks.Add befo=Cells (Row, 0)

Does this make sense, and thanks for your help.

Ian.





All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com