View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Autofilter doesn't work

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


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

--
Regards,
Tom Ogilvy

"Sebastian" wrote in message
...
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