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 search a workbook

Sub aaa()
'
Dim rng as Range, sh as Worksheet
WhatToFind = ActiveCell.Value
for each sh in Workbooks.Worksheets
sh.Activate
set rng = Cells.Find(What:=WhatToFind, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
if not rng is nothing then
rng.Select
ans = msgbox( "continue searching? ", vbYesNo)
if ans = vbNo then exit sub
end if
Next
End Sub


"Esau" wrote in message
...
Is there a way to write this so it will search the
whole workbook at less 10 worksheets

Sub aaa()
'
WhatToFind = ActiveCell.Value
Cells.Find(What:=WhatToFind, After:=ActiveCell,
LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
End Sub

I want to Thank You
Esau