View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Scott Scott is offline
external usenet poster
 
Posts: 149
Default Loop Through All Open Workbooks

tom, can you look at the line

ans = msgbox "Continue to search",vbYesNo

it has a syntax error. thanks


"Tom Ogilvy" wrote in message
...
Dim bk as Workbook, sh as Worksheet
Dim rng as Range, ans as long
for each bk in application.Workbooks
for each sh in bk.Worksheets
set rng = sh.cells.Find("string")
if not rng is nothing then
msgbox "Found at " & rng.Address(external:=True)
ans = msgbox "Continue to search",vbYesNo
if ans = vbNo then exit sub
end if
Next
Next

--
Regards,
Tom Ogilvy

"scott" wrote in message
...
I'm trying to find an example of looping through all open workbooks and
doing a simple search of all cells to determine if a certain value exists

in
any of the workbooks.

Any help?