ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   search a workbook (https://www.excelbanter.com/excel-programming/310416-search-workbook.html)

Esau[_2_]

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

Tom Ogilvy

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





All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com