Printing Filtered Lists

  • Thread starter Thread starter Matthew McManus
  • Start date Start date
M

Matthew McManus

Is it possible to print just the results of a filtered list? At th
moment, I have set the print area to cover all the printable data
have on the sheet. Then when I filter and print I get a lot of blan
pages for the data which has been filtered out.

I could just work out how many pages to ask it to print, but as I nee
to get "uneducated" users to do it, is there an automatic way of doin
it?

thanks
Matthe
 
Dear Matthew

You dont mention whether the users will create their own
filters or not, so the snippet of code below assumes that
the filter will be set by you. If you want the users to
define their own filters, and then print the filtered
data, ignore the part of the code between the asterisks.


Sub FilterAndPrint()

'**********************************************************
'Switch on Auto Filter
Selection.AutoFilter
'Set the filter
Selection.AutoFilter Field:=2, Criteria1:="Your
Criteria" 'Note that the Field number is the column number
'**********************************************************
'Set the range to print (A1 to bottom right cell in
filtered list)
Range("A1").Select
Range(Selection, ActiveCell.SpecialCells
(xlLastCell)).Select
'Print the selected range
Selection.PrintOut Copies:=1, Collate:=True
'Switch off auto filter
Range("A1").Select
Selection.AutoFilter
End Sub

I hope this helps

Paul
 
Back
Top