ragav_in
Board Regular
- Joined
- Feb 13, 2006
- Messages
- 89
- Office Version
- 365
- 2016
- Platform
- Windows
Dear All,
I am trying to filter a range in excel (15 columns) and the filter criteria to be applied on a column (Column 2) which contains description. I want to apply filter on that column to get only the rows of data that meet 3 criteria such as "PMP", "PM Plan", "Project Management Plan". If I use Criteria to filter, I can filter only on 2 values (Criteria1:="*PMP*") & Criteria2:="=*PM Plan*". If I need to search on 3rd criteria, I thought of using Array where I define the Array as Variant and provide these 3 values, and then filter on Array. I am providing the snippets below for your reference.
For 2 Criteria: - This works
ActiveSheet.Range("$A$1:$N$300").AutoFilter Field:=2, Criteria1:="=*PMP*" _
, Operator:=xlOr, Criteria2:="=*PM Plan*"
For more than 2, I use Array: This does not work
Dim arr1 as Variant
arr1 = Array("PMP", "PM Plan", "Project Management Plan")
ActiveSheet.Range("$A$1:$N$300").AutoFilter Field:=2, Criteria1:=arr1, Operator:=xlFilterValues
Please let me know where am I missing.
Also let me know if you need more information, I can provide. I thank you all in advance for your help on this.
Thanks,
ragav_in
I am trying to filter a range in excel (15 columns) and the filter criteria to be applied on a column (Column 2) which contains description. I want to apply filter on that column to get only the rows of data that meet 3 criteria such as "PMP", "PM Plan", "Project Management Plan". If I use Criteria to filter, I can filter only on 2 values (Criteria1:="*PMP*") & Criteria2:="=*PM Plan*". If I need to search on 3rd criteria, I thought of using Array where I define the Array as Variant and provide these 3 values, and then filter on Array. I am providing the snippets below for your reference.
For 2 Criteria: - This works
ActiveSheet.Range("$A$1:$N$300").AutoFilter Field:=2, Criteria1:="=*PMP*" _
, Operator:=xlOr, Criteria2:="=*PM Plan*"
For more than 2, I use Array: This does not work
Dim arr1 as Variant
arr1 = Array("PMP", "PM Plan", "Project Management Plan")
ActiveSheet.Range("$A$1:$N$300").AutoFilter Field:=2, Criteria1:=arr1, Operator:=xlFilterValues
Please let me know where am I missing.
Also let me know if you need more information, I can provide. I thank you all in advance for your help on this.
Thanks,
ragav_in