ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to Dynamically Set Print Area (https://www.excelbanter.com/excel-discussion-misc-queries/10620-how-dynamically-set-print-area.html)

Jerry B

How to Dynamically Set Print Area
 
I have filtered the number of rows and copied them to a separate area of the
worksheet. The number of rows after the filter is unknown. How do I change
the Print Area range of rows to be the number of rows after the filter
(otherwise I will print pages and pages of paper)

Thanks,
--
Jerry B

Tom Ogilvy

Select the area you want printed, then do File=PrintArea = Set Print Area

programmatically

set rng = Range("AB50").CurrentRegion
activesheet.pageSetup.Printarea = rng.Address(external:=True)

Change AB50 to the cell that forms the top left corner of the data you want
to print.

--
Regards,
Tom Ogilvy

"Jerry B" wrote in message
...
I have filtered the number of rows and copied them to a separate area of

the
worksheet. The number of rows after the filter is unknown. How do I

change
the Print Area range of rows to be the number of rows after the filter
(otherwise I will print pages and pages of paper)

Thanks,
--
Jerry B




Jerry B

Hi Tom: Thankyou for the reply. You have given me some ideas. I should
have said this is intended to be part of a macro to filter and then print.
The first row always is "copied" to A200 to T200 but the last cell to be
printed is determined by the advance filter operation and is T200+number of
filtered rows. I am thinking of leaving a marker in the last row and then
matching to determine the row number xxx and then setting the print area to
A200:Txxx in the macro if there is no easier way. Thanks again for your help.

"Jerry B" wrote:

I have filtered the number of rows and copied them to a separate area of the
worksheet. The number of rows after the filter is unknown. How do I change
the Print Area range of rows to be the number of rows after the filter
(otherwise I will print pages and pages of paper)

Thanks,
--
Jerry B



All times are GMT +1. The time now is 05:15 PM.

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