Dear Mahesh, Ideally you should Advanced Filter instead of AutoFilter. For AutoFilter, the code should be as follows:-
Selection.AutoFilter Field:=1, Criteria1:="=here", Operator:=xlOr, Criteria2:="=there" Note:- to include additonal character alongwith here, use ="=*here*" in the code. Best Regards, -- DILIP KUMAR PANDEY MBA-HR,B COM(Hons.),BCA Mobile: +91 9810929744 dilipan...@gmail.com dilipan...@yahoo.com New Delhi - 110062 On 1/26/10, mahesh parab <mahes...@gmail.com> wrote: > > Dear All > Below mention macro auto filter the cells, which contain words mention in > array, but if within cell another word is there then it dont works > Like if cell contain word like "a Here". > how can i change Criteria? > when i record the macro i got criteria1 as Criteria1:="=*Here*" > > i try to modify macro, Criteria1:="=" & vList, this dont works. > > i will appreciate any help on this > > Sub Example2() > > Dim lLastRow As Long > Dim rngToCheck As Range > Dim vList > > Application.ScreenUpdating = False > > vList = Array("Here", "There", "Everywhere") > > With Sheet1 > 'find the last row in column A > lLastRow = .Cells(.Rows.Count, 1).End(xlUp).Row > > Set rngToCheck = .Range(.Cells(1, 1), .Cells(lLastRow, 1)) > End With > > With rngToCheck > .AutoFilter _ > Field:=1, _ > *Criteria1:=vList,* _ > Operator:=xlFilterValues > > End With > > Application.ScreenUpdating = True > End Sub > > > > > > > > > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at > http://www.excelitems.com > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > If you find any spam message in the group, please send an email to: > Ayush Jain @ jainayus...@gmail.com > <><><><><><><><><><><><><><><><><><><><><><> > HELP US GROW !! > > We reach over 6,700 subscribers worldwide and receive many nice notes about > the learning and support from the group.Let friends and co-workers know they > can subscribe to group at > http://groups.google.com/group/excel-macros/subscribe > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,700 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe