Print Area Question

W

Will Francis

Hi Folks

I am looking for a piece of code which will enable me to
print a selection, the selection being cells selected by
AutoFiltering cells.

At the moment I have code which filters cells, how do I
then set this range as the print area?

Any help appreciated.

Thanks
Will
 
A

Abdul Salam

Hi,


Only the visible cells (filtered data will be printed
when you just do..

ActiveWindow.SelectedSheets.PrintOut Copies:=1

Abdul Salam
 
W

Will Francis

Thanks for that Abdul.

However, when I use the code, I get lots of blank lines
appearing after the filtered data (my sheet has formatting
which extends far beyond the end of the filtered data).

Ideally, I am looking to get the filtered data onto 1 page
if possible.

Thanks
Will
 
T

Tom Ogilvy

With ActiveSheet.PageSetup
.PrintArea = _
ActiveSheet.Autofilter.Range.Address(True,True,xlA1,True)
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Activesheet.Printout
 

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

Top