Help: Autofilter doesn't work

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
 
T

Tom Ogilvy

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


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top