VBA to set which columns in Autofilter

  • Thread starter Thread starter miker1999
  • Start date Start date
M

miker1999

Hello,
I have put code my worksheet_activate to automatically turn on th
Autofilter:

If Not AutoFilterMode Then Cells.AutoFilter

Is there a way to set it to only turn the autofilter on for certai
columns? I need to filter columns A and C:F.

Also, in this code, can I set which row to put the Autofilter on?

Thanks!
Mik
 
If Activesheet.AutoFilterMode Then Cells.AutoFilter
Range("A5").CurrentRegion.Resize(,6).AutoFilter _
Field:=3, Criteria1:="F"

I don't think you can skip columns, but I am not sure what would be the
point.

The autofilter filters the entire row, so if a row is hidden, it is hidden
all the way across.
 
You can hide the autofilter arrow with something like:

ActiveSheet.AutoFilter.Range.Columns(2).AutoFilter field:=2, _
visibledropdown:=False

(Assumes the filter is already in place starting in column A.)
 
Back
Top