ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting Vertical Page Breaks (https://www.excelbanter.com/excel-programming/408136-setting-vertical-page-breaks.html)

J.W. Aldridge

Setting Vertical Page Breaks
 
I asked this question earlier today, but may have scared people off
with how I worded the question. So, is there anyway to set the
vertical page break ranges after the print area has been established?

I would like set the page break at n51, n91, n131, etc.


Sub SetPrtAr_mysheet()
Dim lLastRow As Long
lLastRow = Range("I65536:K65536").End(xlUp).Row
Orientation = xlLandscape
ActiveSheet.PageSetup.PrintArea = Range("a6:N" & lLastRow).Address
End Sub


Thanx

JLGWhiz

Setting Vertical Page Breaks
 
Here is the syntax to add the vertical page breaks. I have not used this,
so I don't know what this does to the automatic page breaks that are set in
the PageSetup exercise. You probably should test this a little before trying
to implement it in full code.

ActiveSheet.VPageBreaks.Add Befo=ActiveCell

Substitute a Range reference for ActiveCell. It looks like you might have
to do it more than once or loop with an array to do what you described.
Anyhow, you can play with it.

"J.W. Aldridge" wrote:

I asked this question earlier today, but may have scared people off
with how I worded the question. So, is there anyway to set the
vertical page break ranges after the print area has been established?

I would like set the page break at n51, n91, n131, etc.


Sub SetPrtAr_mysheet()
Dim lLastRow As Long
lLastRow = Range("I65536:K65536").End(xlUp).Row
Orientation = xlLandscape
ActiveSheet.PageSetup.PrintArea = Range("a6:N" & lLastRow).Address
End Sub


Thanx



All times are GMT +1. The time now is 08:48 PM.

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