ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determining Portrait or Landscape (https://www.excelbanter.com/excel-programming/377402-determining-portrait-landscape.html)

Otto Moehrbach

Determining Portrait or Landscape
 
Excel XP & Win XP
I am helping an OP with a task that involves hiding/unhiding a variable
number of columns. When it comes time for the code to print, it will be
necessary that the code select Portrait or Landscape for the printing,
depending on the total width of the visible columns (either way, the print
range is no more than one page wide).
My question is: What would be the code to determine the location of the
first vertical page break?
Thanks for your time. Otto



JLGWhiz

Determining Portrait or Landscape
 
This was obtained from the VBA Help file:

This example sets a manual page break above row 25 on Sheet1.

Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakManual

This example sets a manual page break to the left of column J on Sheet1.

Worksheets("Sheet1").Columns("J").PageBreak = xlPageBreakManual

This example deletes the two page breaks that were set in the preceding
examples.

Worksheets("Sheet1").Rows(25).PageBreak = xlPageBreakNone
Worksheets("Sheet1").Columns("J").PageBreak = xlNone

Have fun..



"Otto Moehrbach" wrote:

Excel XP & Win XP
I am helping an OP with a task that involves hiding/unhiding a variable
number of columns. When it comes time for the code to print, it will be
necessary that the code select Portrait or Landscape for the printing,
depending on the total width of the visible columns (either way, the print
range is no more than one page wide).
My question is: What would be the code to determine the location of the
first vertical page break?
Thanks for your time. Otto




NickHK

Determining Portrait or Landscape
 
ActiveSheet.VPageBreaks(1).Location.Address

NickHK

"Otto Moehrbach" wrote in message
...
Excel XP & Win XP
I am helping an OP with a task that involves hiding/unhiding a variable
number of columns. When it comes time for the code to print, it will be
necessary that the code select Portrait or Landscape for the printing,
depending on the total width of the visible columns (either way, the print
range is no more than one page wide).
My question is: What would be the code to determine the location of the
first vertical page break?
Thanks for your time. Otto






All times are GMT +1. The time now is 02:51 AM.

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