How to Dynamically Set Print Area

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top