ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   .Find Across Multiple worksheets (https://www.excelbanter.com/excel-programming/338048-find-across-multiple-worksheets.html)

mozart[_3_]

.Find Across Multiple worksheets
 

In a previous post I had a question regarding .find as I wanted to write
a macro that would loop through some code and find a value given a value
stored in a variable.

This is all fine however i have found that .Find does not like to look
beyond the the current worksheet that has focus. In other words it does
not parse the other sheets and stops after it has parsed the currently
selected sheet.

There something I am missing or do I need some smart code.

I have the below (minus error0 handling) the find code I am using


Cells.Find(What:=Grand, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cheers

Mozart


--
mozart
------------------------------------------------------------------------
mozart's Profile: http://www.excelforum.com/member.php...o&userid=13314
View this thread: http://www.excelforum.com/showthread...hreadid=398137


PCLIVE

.Find Across Multiple worksheets
 
I found this code on the URL below. I don't know if it works, but give it a
shot.

http://www.mrexcel.com/archive/Edit/3621.html

Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
'PUT YOUR CODE HERE
Next ws

HTH,
Paul


"mozart" wrote in
message ...

In a previous post I had a question regarding .find as I wanted to write
a macro that would loop through some code and find a value given a value
stored in a variable.

This is all fine however i have found that .Find does not like to look
beyond the the current worksheet that has focus. In other words it does
not parse the other sheets and stops after it has parsed the currently
selected sheet.

There something I am missing or do I need some smart code.

I have the below (minus error0 handling) the find code I am using


Cells.Find(What:=Grand, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cheers

Mozart


--
mozart
------------------------------------------------------------------------
mozart's Profile:
http://www.excelforum.com/member.php...o&userid=13314
View this thread: http://www.excelforum.com/showthread...hreadid=398137




Tom Ogilvy

.Find Across Multiple worksheets
 
Try grouping your sheets before you run your FIND code:

Sheets.Select


--
Regards,
Tom Ogilvy


"mozart" wrote in
message ...

In a previous post I had a question regarding .find as I wanted to write
a macro that would loop through some code and find a value given a value
stored in a variable.

This is all fine however i have found that .Find does not like to look
beyond the the current worksheet that has focus. In other words it does
not parse the other sheets and stops after it has parsed the currently
selected sheet.

There something I am missing or do I need some smart code.

I have the below (minus error0 handling) the find code I am using


Cells.Find(What:=Grand, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cheers

Mozart


--
mozart
------------------------------------------------------------------------
mozart's Profile:

http://www.excelforum.com/member.php...o&userid=13314
View this thread: http://www.excelforum.com/showthread...hreadid=398137





All times are GMT +1. The time now is 10:38 AM.

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