Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Autofilter contains vba strDept

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Autofilter contains vba strDept

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Autofilter contains vba strDept


RADO,

It now runs but doesn't filter anything out and when you
hover the cursor over the strDept it doesn't pick what it
contains, any other ideas?

Mark

-----Original 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




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Autofilter contains vba strDept

RADO,

Sorted it, thanks

I created another string which included the wildcards

Regards


Mark
-----Original Message-----

RADO,

It now runs but doesn't filter anything out and when you
hover the cursor over the strDept it doesn't pick what it
contains, any other ideas?

Mark

-----Original 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




.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . giblon Excel Discussion (Misc queries) 1 February 16th 06 12:23 PM


All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"