View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Autofilter contains vba strDept

That should be

Criteria1:= "*" & strDept & "*"

or
Criteria1:= "=*" & strDept & "*"

--
Regards,
Tom Ogilvy


"RADO" wrote in message
...
put your wildcard expression in quotes:

"* & strDept & *"

RADO

"Mark" wrote in message
...
Help Please!

I'm sure this is an easy one, but I'm going around in
circles and failing badly!!

I want to do an autofilter which contains a string which
is selected from a userform combo, the code I have do so
far is: -

Sub FilterTaskChart()

Worksheets("Task Chart").Visible = True
Worksheets("Task Chart").Activate

frmDept.Show

Worksheets("Task Chart").Range("A2").AutoFilter _
Field:=1, _
Criteria1:= * & strDept & *, Operator _
:=xlAnd

Range("A1").Select

End Sub

It fails on the 'wildcard string wildcard' bit.

Can anyone assist with a solution, please?


Mark