I have a column with values like the below sample:
Size |
---|
4 |
1*4 |
1*24 |
4*1 |
4.5*10 |
2*14*5 |
3*4*5 |
I need to set a filter to get the cells contains the specific number e.g "4" ,
the expected results are (4 , 1*4 , 4*1 , 3*4*5
).
If I used wildcards "*4*
" as criteria then it will give me all values contains "4
" like (1*24 , 4.5*10
) and that not required.
the below code only find the cells that begins with my number:
Sub AutoFilter_on_number()
Dim ws As Worksheet, rng As Range
Const filterColumn As Long = 29 'column "AC"
Set ws = ActiveSheet
Set rng = ws.Range("A2:AH7000")
rng.AutoFilter Field:=filterColumn, Criteria1:="=4*", Operator:=xlFilterValues
End Sub