Help: Autofilter doesn't work

  • Thread starter Thread starter Sebastian
  • Start date Start date
S

Sebastian

I need to filter data in a sheet using a string as
criteria.

The problem I encountered is I get the string in this way:

Set mycell = Sheets("DPC").Range("Q3")

where in cell Q3 I insert a string key to perfom filtering.

If I use this code it obviously doesn't work, as it look
for "my_value" not for the value itself

Selection.AutoFilter Field:=3, Criteria1:="=my_value",
Operator:=xlAnd

Whay can I do?

Thanks Sebastian
 
Set mycell = Sheets("DPC").Range("Q3")


Selection.AutoFilter Field:=3, Criteria1:= "=" & mycell.Value, _
Operator:=xlAnd
 
Back
Top