Now using the UI facilities:
Autofilter:
and advancedfilterCode:Sub M_snb_003() sn = Range("B1:B3") With Columns(1) .AutoFilter 1, sn(1, 1), xlOr, sn(2, 1) .SpecialCells(12).Delete xlShiftUp .AutoFilter .AutoFilter 1, sn(3, 1) .SpecialCells(12).Delete xlShiftUp .AutoFilter End With End Sub
The criterion range can be filled manually (or only once); after that you can test the speed of avancedfilter.Code:Sub M_snb_004() Cells(1, 4).Resize(, 3) = Cells(1, 1).Value Cells(2, 4).Resize(, 3) = Array("<>" & Cells(1, 2), "<>" & Cells(2, 2), "<>" & Cells(3, 2)) Columns(1).AdvancedFilter 2, Cells(1, 4).CurrentRegion, Cells(1, 12) End Sub
For simplicity's sake I added the code to fill the criterion range.




Reply With Quote
Bookmarks