ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pages break in the 66rd line , 132, etc... (https://www.excelbanter.com/excel-programming/362789-pages-break-66rd-line-132-etc.html)

...Patrick[_7_]

pages break in the 66rd line , 132, etc...
 
Hello,
(sorry for my poor english) :-))

I copy a lot of tables in one to resume (it works) ; all areas have the same
structure (from column A to K) but not the same numbers of rows; the grand
total varies from 200 to 500 lines; i would like, after the copy, to place
page break all the 66 lines (with a font 10, A4 paper) but if the ligne
66-132 etc.. is not free, the page break must be placed in a free
line..before like 65-64-63.

Thank you

Patrick



Tom Ogilvy

pages break in the 66rd line , 132, etc...
 
Something like this pseudo code. You might have to play with it a little to
get the pagebreaks exactly where you want them.


Lastrow = cells(rows.count,1).End(xlup).row
i = 66
do
j = i + 1
do
j = j -1
if Application.CountA(rows(j)) = 0 then _
Activesheet.HPageBreaks.Add Befo=rows(j + 1)
Loop while Application.CountA(rows(j)) < 0
i = j + 66
Loop while i < LastRow

--
Regards,
Tom Ogilvy



"...Patrick" wrote:

Hello,
(sorry for my poor english) :-))

I copy a lot of tables in one to resume (it works) ; all areas have the same
structure (from column A to K) but not the same numbers of rows; the grand
total varies from 200 to 500 lines; i would like, after the copy, to place
page break all the 66 lines (with a font 10, A4 paper) but if the ligne
66-132 etc.. is not free, the page break must be placed in a free
line..before like 65-64-63.

Thank you

Patrick




...Patrick[_7_]

pages break in the 66rd line , 132, etc...
 
Thank you Tom

i go to "play" with this ...

Patrick


"Tom Ogilvy" a écrit dans le message
de news: ...
Something like this pseudo code. You might have to play with it a little
to
get the pagebreaks exactly where you want them.


Lastrow = cells(rows.count,1).End(xlup).row
i = 66
do
j = i + 1
do
j = j -1
if Application.CountA(rows(j)) = 0 then _
Activesheet.HPageBreaks.Add Befo=rows(j + 1)
Loop while Application.CountA(rows(j)) < 0
i = j + 66
Loop while i < LastRow

--
Regards,
Tom Ogilvy



"...Patrick" wrote:

Hello,
(sorry for my poor english) :-))

I copy a lot of tables in one to resume (it works) ; all areas have the
same
structure (from column A to K) but not the same numbers of rows; the
grand
total varies from 200 to 500 lines; i would like, after the copy, to
place
page break all the 66 lines (with a font 10, A4 paper) but if the ligne
66-132 etc.. is not free, the page break must be placed in a free
line..before like 65-64-63.

Thank you

Patrick






All times are GMT +1. The time now is 11:56 AM.

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