Dear Mahesh, Every "contain condition" can only be applied as single criteria and you have three criteria for contain (here,there,everywhere). In VBA, I think maximum of two criteria is allowed. On applying criterea3 it was throwing an error.
But I think if you will use condition "contain here", it will cover all your three words. Below is the code which you may use. Let me know if it helps. @ Excel Group : Can you suggest some better solution. Thank you. Sub Example2() Dim lLastRow As Long Dim rngToCheck As Range Application.ScreenUpdating = False 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:="*here*", Operator:=xlFilterValues End With Application.ScreenUpdating = True End Sub Best Regards, Ayush Jain. [Group Owner] On Jan 26, 9:19 pm, 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