VBA to Apply Auto Filter

VBA to apply a filter on the table. Will hide rows that don’t match the filter criteria.
Add <> in front of the FilterTerm to filter out that word.
Add * around FilterTerm to make wildcard search, filters if that word is contained within the cell.

Apply Auto Filter with 1 criteria

rws = ActiveSheet.UsedRange.Rows.Count
Set FilterRng = ActiveSheet.Range(“A1:Z” & rws)
FilterRng.AutoFilter Field:=1, Criteria1:=”FilterTerm”

Apply Auto Filter with multiple criteria

rws = ActiveSheet.UsedRange.Rows.Count
Set FilterRng = ActiveSheet.Range(“A1:Z” & rws)
FilterRng.AutoFilter Field:=1, Criteria1:=Array( _
“FilterTerm1”, “FilterTerm2”), Operator:=xlFilterValues

Apply Auto Filter with 1 criteria to show does not contain FilterTerm

rws = ActiveSheet.UsedRange.Rows.Count
Set FilterRng = ActiveSheet.Range(“A1:Z” & rws)
FilterRng.AutoFilter Field:=1, Criteria1:=”<>FilterTerm”

[efb_likebox fanpage_url="https://www.facebook.com/vbamarket/" box_width="840" box_height=340"" responsive="1" show_faces="1" show_stream="1" hide_cover="1" small_header="0" hide_cta="0" locale="en_US"]