coloradomtns
New Member
- Joined
- Apr 14, 2016
- Messages
- 5
Hello all,
I am stuck on an autofilter issue. I am trying to add criteria to an existing filtered column named "Interval".
I have an Excel table with a column containing string or numeric data (see table below).
I need to filter and return all records that are contained in the array (note I do not need to use an array).
The code below only returns records with B1 and 7.
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD]Interval
[/TD]
[/TR]
[TR]
[TD]A1,B1
[/TD]
[/TR]
[TR]
[TD]7,8
[/TD]
[/TR]
[TR]
[TD]B1
[/TD]
[/TR]
[TR]
[TD]A1,C1
[/TD]
[/TR]
[TR]
[TD]2,3,4
[/TD]
[/TR]
[TR]
[TD]6A,6E,6F
[/TD]
[/TR]
[TR]
[TD]A1,B1,2,3,4,5
[/TD]
[/TR]
[TR]
[TD]6A,6B,6C
[/TD]
[/TR]
[TR]
[TD]A1,B1,2,3,4,5,6,7,8
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[/TR]
[TR]
[TD]2,3,4
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[/TR]
[TR]
[TD]5,6A,6E,7,8
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[/TR]
</tbody>[/TABLE]
Here is my code that I'm currently using below. It only returns B1 and 7 - need to see all records containing 6A, B1, and 7.
=========================
Sub Macro5()
Dim i As Long, arr As Variant
arr = Array("6A", "B1", "7")
ActiveSheet.Range("A1:A15").AutoFilter field:=1, Criteria1:=arr, Operator:=xlFilterValues
End Sub
Thanks!
I am stuck on an autofilter issue. I am trying to add criteria to an existing filtered column named "Interval".
I have an Excel table with a column containing string or numeric data (see table below).
I need to filter and return all records that are contained in the array (note I do not need to use an array).
The code below only returns records with B1 and 7.
[TABLE="class: grid, width: 50, align: left"]
<tbody>[TR]
[TD]Interval
[/TD]
[/TR]
[TR]
[TD]A1,B1
[/TD]
[/TR]
[TR]
[TD]7,8
[/TD]
[/TR]
[TR]
[TD]B1
[/TD]
[/TR]
[TR]
[TD]A1,C1
[/TD]
[/TR]
[TR]
[TD]2,3,4
[/TD]
[/TR]
[TR]
[TD]6A,6E,6F
[/TD]
[/TR]
[TR]
[TD]A1,B1,2,3,4,5
[/TD]
[/TR]
[TR]
[TD]6A,6B,6C
[/TD]
[/TR]
[TR]
[TD]A1,B1,2,3,4,5,6,7,8
[/TD]
[/TR]
[TR]
[TD]7
[/TD]
[/TR]
[TR]
[TD]2,3,4
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[/TR]
[TR]
[TD]5,6A,6E,7,8
[/TD]
[/TR]
[TR]
[TD]5
[/TD]
[/TR]
</tbody>[/TABLE]
Here is my code that I'm currently using below. It only returns B1 and 7 - need to see all records containing 6A, B1, and 7.
=========================
Sub Macro5()
Dim i As Long, arr As Variant
arr = Array("6A", "B1", "7")
ActiveSheet.Range("A1:A15").AutoFilter field:=1, Criteria1:=arr, Operator:=xlFilterValues
End Sub
Thanks!