View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Entire Workbook Search

Sub FindInWorkbook()
Dim rng as Range, sh as Worksheet
Dim vTarget as Variant, fAddr as String
vTarget = "dog"
For each sh in ActiveWorkbook.Worksheets
With sh.Cells
Set rng = .Find(vTarget, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
fAddr = rng.Address
Do
msgbox rng.Address(0,0,xlA1,external:=True)
Set rng = .FindNext(rng)
Loop While rng.Address < fAddr
End If
End With
Next sh
End Sub

--
Regards,
Tom Ogilvy


"ArtLab" wrote in message
...
Is there any way to perform a "global" search or "lookup" of a given piece
of data in an entire workbook composed of several worksheets?? Any advise
will be greatly appreciated.

Art