Use the following subsection, which takes two criteria to filter the table and copy the filtered data onto sheet2. You can add more criteria as needed.
Sub Filter2Criteria()
Dim str1, str2 As Variant
Dim Tbl As ListObject
Dim FiltRng As Range
Dim RngArea As Range
Set Tbl = Sheet1.ListObjects("DataTable")
str1 = Application.InputBox("Select the Country Code")
str2 = Application.InputBox("Select the Country Code")
If str1 = False Then
MsgBox "Please select first Country", , "Input"
Exit Sub
ElseIf str2 = False Then
MsgBox "Please select second Country", , "Input"
Exit Sub
End If
Tbl.Range.AutoFilter Field:=6, Criteria1:=str1, Operator:=xlOr, Criteria2:=str2
Set FiltRng = Tbl.Range.SpecialCells(xlCellTypeVisible)
FiltRng.Copy Sheets("Sheet2").Range("A2")
End Sub
source
share