Searching for a text string across multiple workbooks

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

Is there a way to search across multiple spreadsheets in multiple
workbooks? I need to search for a name across many workbooks.
 
Dim list as Variant
Dim i as Long
Dim sh as Worksheet
Dim rng as Range
list = Array("book1.xls","book2.xls","book3.xls")
for i = lbound(list) to ubound(list)
for each sh in Workbooks(list(i)).worksheets
set rng = sh.cells.find(sTarget, . . . other args)
if not rng is nothing then
rng.parent.parent.Activate
rng.parent.activate
rng.select
End if
msgbox "hit key to continue search"
Next
Next
 
'Workbooks' and not 'Worksheets' right??

You could try going into Windows Explorer, right clicking on the top folder that
holds all the files/subfolders, do Search and in filename put *.xls and in the
'containing text' field put the name you are looking for.
 
And see one more response to your other post.

Is there a way to search across multiple spreadsheets in multiple
workbooks? I need to search for a name across many workbooks.
 
Back
Top