(Solved) – VBA Autofilter with any multiple criteria


Do you know when you type a value into Autofilter search box, and then do a second search and choose to add the selection to the current filter? How is it possible to do this in a VBA code?

I want that the strings “605“, “617“, “627“, “632“, “647“, “649” be filtered in the same column, and any cell that contains any of the values above appears in the filter, like an OR logic.

Sub FiltroPosiĆ§Ć£o2()

 ColunaFiltro = ActiveCell.Column - ActiveSheet.AutoFilter.Range.Column   1

 ActiveSheet.Range(ActiveSheet.AutoFilter.Range.Address).AutoFilter _
     Field:=ColunaFiltro, _
     Criteria1:=Array("*605*", "*617*", "*627*", "*632*", "*647*", "*649*")

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *