ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find print area when no print area set (https://www.excelbanter.com/excel-programming/391783-find-print-area-when-no-print-area-set.html)

mcphc

Find print area when no print area set
 
I have a worksheet that is shown in page break preview view.

The heavy blue outline shows the boundary of what is shown in a print preview.

There is no print area set. I would like a macro that would find the address
of this blue boundary and set it to the print area.

How can this be done?

Thanks

JNW

Find print area when no print area set
 
Range("A1").SpecialCells(xlLastCell).address will give you the bottom right
cell used.
--
JNW


"mcphc" wrote:

I have a worksheet that is shown in page break preview view.

The heavy blue outline shows the boundary of what is shown in a print preview.

There is no print area set. I would like a macro that would find the address
of this blue boundary and set it to the print area.

How can this be done?

Thanks


mcphc

Find print area when no print area set
 
Found it!

ActiveSheet.PageSetup.PrintArea = ActiveSheet.UsedRange.Address

So simple!

"mcphc" wrote:

I have a worksheet that is shown in page break preview view.

The heavy blue outline shows the boundary of what is shown in a print preview.

There is no print area set. I would like a macro that would find the address
of this blue boundary and set it to the print area.

How can this be done?

Thanks


JNW

Find print area when no print area set
 
Thanks that is easy!
--
JNW


"mcphc" wrote:

Found it!

ActiveSheet.PageSetup.PrintArea = ActiveSheet.UsedRange.Address

So simple!

"mcphc" wrote:

I have a worksheet that is shown in page break preview view.

The heavy blue outline shows the boundary of what is shown in a print preview.

There is no print area set. I would like a macro that would find the address
of this blue boundary and set it to the print area.

How can this be done?

Thanks



All times are GMT +1. The time now is 03:55 PM.

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