Hi,
I wish to filter a column based on an input range in same (or another) column for eg.
<tbody>
</tbody>
Criteria range for the filter is:
<tbody>
</tbody>
I am currently using a macro but that requires me to enter the range in the code:
Sub Test()
Dim Arr As Variant
Dim i As Integer
Arr = WorksheetFunction.Transpose(ActiveSheet.Range("A45:A47").Value)
For i = LBound(Arr) To UBound(Arr)
Arr(i) = CStr(Arr(i))
Next i
ActiveSheet.Range("$A$1:$A$12").AutoFilter Field:=1, Criteria1:=Arr, Operator:=xlFilterValues
End Sub
Can anyone help me create the macro where the 1st range is "selection" and criteria range is read from input box?
Thanks
I wish to filter a column based on an input range in same (or another) column for eg.
A | B | |
1 | Account | Value |
2 | bbb | 150 |
3 | aaa | 100 |
4 | ccc | 200 |
5 | aaa | 150 |
6 | bbb | 250 |
7 | vvv | 200 |
8 | aaa | 150 |
9 | ccc | 100 |
10 | ddd | 50 |
11 | sss | 250 |
12 | bbb | 100 |
<tbody>
</tbody>
Criteria range for the filter is:
A | |
45 | aaa |
46 | ccc |
47 | bbb |
<tbody>
</tbody>
I am currently using a macro but that requires me to enter the range in the code:
Sub Test()
Dim Arr As Variant
Dim i As Integer
Arr = WorksheetFunction.Transpose(ActiveSheet.Range("A45:A47").Value)
For i = LBound(Arr) To UBound(Arr)
Arr(i) = CStr(Arr(i))
Next i
ActiveSheet.Range("$A$1:$A$12").AutoFilter Field:=1, Criteria1:=Arr, Operator:=xlFilterValues
End Sub
Can anyone help me create the macro where the 1st range is "selection" and criteria range is read from input box?
Thanks
Last edited: