Searching for a text string across multiple workbooks

J

JJ

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

Tom Ogilvy

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
 
K

Ken Wright

'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.
 
D

Dave Peterson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top