Auto Filter with More Than Two Conditions

Submitted by Richie Sills of Worcester, England. Richie is a tax manager at a firm of chartered accountants.

The autofilter in Excel VBA allows only two criteria. The following code shows how three or more criteria can be used with the autofilter:

Sub MultiFilter()

Dim rngTarget As Range, rngl As Range, rng2 As Range, rngMyRange As Range

Const Critl As String = "Critl" Const Crit2 As String = "Crit2" Const Crit3 As String = "Crit3" 'the AutoFilter criteria to use

Application.ScreenUpdating = False With Worksheets("Sheet1") .Rows(1).Insert .Range("A1").Value = "dummy"

0 0

Post a comment