paste the macro in worksheet change event . if your search criteria is in sheet 1 the paste the macro in Worksheet_Change even tof sheet 1
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Row = 3 And Target.Column = 5 Then ActiveSheet.Rows("6:65356").Clear Sheets("database").Activate If Sheets("database").FilterMode Then Sheets("database").ShowAllData End If Z = Sheets("database").Range("a1").End(xlDown).Row Sheets("database").Range("$A$1:$c" & Z).AutoFilter Field:=1, Criteria1:="*" & Sheets(1).Range("e3").Value & "*" Sheets("database").AutoFilter.Range.Copy Sheets(1).Range("d5") If Sheets("database").FilterMode Then Sheets("database").ShowAllData End If Sheets(1).Activate End If End Sub On Tue, Apr 19, 2011 at 11:12 AM, C.G.Kumar <kumar.bemlmum...@gmail.com>wrote: > Thnaks Ashish. > > It is very useful but i am not getting desired output when i copy VBA code > to my actual workbook.Please suggest Where i have to make change. > > Regards, > > C.G.Kumar > > > > On Mon, Apr 18, 2011 at 6:18 PM, ashish koul <koul.ash...@gmail.com>wrote: > >> try this see if it helps >> >> On Mon, Apr 18, 2011 at 2:21 PM, C.G.Kumar <kumar.bemlmum...@gmail.com>wrote: >> >>> Hello, >>> I have a very tricky problem. I have got an excel sheet having some >>> columns but more than 5000 rows. In those columns there are some names which >>> may/may not be similar to each other. I want to make a macro which can: >>> 1. Search for the name. e.g. If I have Katie Holmes in 1st row, Sherlock >>> Holmes in 2nd row, Holmes Matt in 3rd row, James Holmes Dammon in 4th row >>> and so on....then if put only Holmes in search criteria then it should get >>> the result for all the 4 rows. >>> 2. Secondly it should display only those 4 rows in the result. Like if we >>> are using a sort function. >>> >>> >>> Regards, >>> >>> C.G.Kumar >>> >> >> >> >> -- >> *Regards* >> * * >> *Ashish Koul* >> *akoul*.*blogspot*.com <http://akoul.blogspot.com/> >> *akoul*.wordpress.com <http://akoul.wordpress.com/> >> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> >> >> >> P Before printing, think about the environment. >> >> >> -- >> >> ---------------------------------------------------------------------------------- >> Some important links for excel users: >> 1. Follow us on TWITTER for tips tricks and links : >> http://twitter.com/exceldailytip >> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 >> 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 >> >> <><><><><><><><><><><><><><><><><><><><><><> >> Like our page on facebook , Just follow below link >> http://www.facebook.com/discussexcel >> > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 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 > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- *Regards* * * *Ashish Koul* *akoul*.*blogspot*.com <http://akoul.blogspot.com/> *akoul*.wordpress.com <http://akoul.wordpress.com/> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> P Before printing, think about the environment. -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 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 <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel