Serching by Keyword using VBA Code, I need help...

doms123

Board Regular
Joined
Apr 19, 2011
Messages
58
Hi I am using excel 2007 and I am trying to put code inside a button that if i push the button and can search by its keyword from the list. The code I'm generating is this when i record macros

ActiveSheet.Range("$D$1:$D$6").AutoFilter Field:=1, Criteria1:="=*Wayde*", _
Operator:=xlAnd


i need is some how like this but it has an error

ActiveSheet.Range("$D$1:$D$6").AutoFilter Field:=1, Criteria1:=
"=*Sheet1.range(A1).value*", Operator:=xlAnd

Please Help me with the code
Thank you in advance...

PS I have a searching code but it goes something like this...
Sheet5.Range("$A$2:$W$35000").AutoFilter Field:=6

but this code only search by the whole word and not the keyword....
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
i need is some how like this but it has an error

ActiveSheet.Range("$D$1:$D$6").AutoFilter Field:=1, Criteria1:=
"=*Sheet1.range(A1).value*", Operator:=xlAnd
On the right track. :)
Try this

ActiveSheet.Range("$D$1:$D$6").AutoFilter Field:=1, Criteria1:="=*" & Sheet1.Range("A1").Value & "*"
 
Upvote 0

Forum statistics

Threads
1,216,739
Messages
6,132,438
Members
449,728
Latest member
teodora bocarski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top