Info

'set up dummy header

Set rngTarget = .Range("A1:A" & .Cells(Rows.Count, l).End(xlUp).Row) 'set the range to work with rngTarget.AutoFilter Field:=1, Criteria1:=Crit1, _

Operator:=xlOr, Criteria2:=Crit2 'get first two criteria

.Resize(.AutoFilter.Range.Rows.Count - 1). _ SpecialCells(xlCellTypeVisible) 'range with first 2 (use offset and resize to exclude header) rngTarget.AutoFilter 'reset autofilter rngTarget.AutoFilter Field:=1, Criteria1:=Crit3 'get third criteria

.Resize(.AutoFilter.Range.Rows.Count - 1). _ SpecialCells(xlCellTypeVisible) 'range with 3rd rngTarget.AutoFilter .Rows(1).Delete 'remove dummy header Set rngMyRange = Union(rng1, rng2) 'combine the range rngMyRange.EntireRow.Copy Destination:=Worksheets("Sheet2").Range("A1") 'or whatever you want to do ... End With

Application.ScreenUpdating = True End Sub

0 0

Post a comment