PDA

View Full Version : Autofilter in VBA for selected string in a cell



04-Jun-10
12-01-2010, 12:39 PM
Hi All,

I Hope you all could help me on this.

As you could see in attached xls file, I need to filter out only those columns which have their string value as "john".
Autofilter can be applied if the complete string is "john". But here its a part of string and so I couldn't do it with autofilter option. Is it possible to apply autofilter in this scenario? If not, could you please guide me on how to apply this functionality?

Thanks,
Madan

stanleydgrom
12-01-2010, 02:31 PM
Madan,

Welcome to the VBA Express forum.


Highlite the data in column D, range D1:D10
Click on Data, Filter
Click on the down arrow in cell D1
Click on Text Filters
Click on Contains…
In the box to the right of contains, type in john
Click on the OK button

04-Jun-10
12-02-2010, 02:55 AM
Hello Stanley,

Thanks for your help.

Can you let me know if this can be done in VBA macros (back-end)?
If possible, post the source code for this change also.

Many Thanks,
Madan

stanleydgrom
12-02-2010, 09:55 PM
Madan,

Detach/open workbook VBAX Newbie - VE3530 - SDG10.xlsm and run macro FilterContainsjohn.


Have a great day,
Stan