Dear Raghu, Plwase try it..
Dim j As Long Dim fldpath Dim fld, fil, subfld As Object Sub search_workbooks() Application.DisplayAlerts = False Application.ScreenUpdating = False '********************* to get file names in folder Application.FileDialog(msoFileDialogFolderPicker).Title = "Choose Folder" Application.FileDialog(msoFileDialogFolderPicker).Show fldpath = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1) & "\" Set fso = CreateObject("scripting.filesystemobject") Set fld = fso.getfolder(fldpath) getnames fld Application.DisplayAlerts = True Application.ScreenUpdating = True End Sub Sub getnames(ByRef prntfld) For Each fil In prntfld.Files j = Sheets(1).Range("A65356").End(xlUp).Row + 1 ' WILL SEARCH only excel files If UCase(Right(fil.Path, 4)) = UCase(".xls") Or UCase(Right(fil.Path, 5)) = UCase(".xlsx") Then Set swa = Application.Workbooks.Open(fil.Path) Windows(fil.Name).Visible = False For Each wk In swa.Worksheets Set a = Nothing Set a = wk.Cells.Find(What:="*" & ThisWorkbook.Sheets("File Names").Range("c2").Value & "*", After:=wk.Cells(1, 1), _ LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) If Not a Is Nothing Then r = ThisWorkbook.Sheets("File Names").Range("a65356").End(xlUp).Row + 1 ThisWorkbook.Sheets("File Names").Cells(r, 1).Value = fil.Path ThisWorkbook.Sheets("File Names").Cells(r, 2).Value = Right(fil.Name, Len(fil.Name) - InStrRev(fil.Name, ".") + 1) ThisWorkbook.Sheets("File Names").Cells(r, 3).Value = Left(fil.Name, InStrRev(fil.Name, ".") - 1) Exit For End If Next wk Windows(fil.Name).Visible = True swa.Close End If Next fil For Each subfld In prntfld.SubFolders getnames subfld Next subfld End Sub On Sat, Feb 18, 2012 at 11:20 PM, raghu gr <balaji.bra...@gmail.com> wrote: > hi all, > > how to find a text in folder. > > Example - suppose in 1 folder there are 40 excel files, if i want find a > text "apple" is in which file (as it becomes tedious to open each and every > file and use ctrl +F option). > > > with regards > raghu > > > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > -- Thanks & regards, Noorain Ansari *http://noorainansari.com/* <http://excelmacroworld.blogspot.com/> *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/> -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com