You'd want to exit the routine if the cell is found. Also, you can use
application.goto to select the cell. I would also be weary about hidden
sheets if any.

Sub lookinallsheets()

    Dim wks As Worksheet
    Dim rng As Range
    For Each wks In Worksheets
        With wks
            Set rng = .Cells.Find(What:="whattolookfor", LookIn:=xlValues,
LookAt:=xlWhole)
                If Not rng Is Nothing Then
                    Application.Goto rng
                    Exit For
                End If
        End With
    Next wks

End Sub

Regards,
Sam Mathai Chacko

On Tue, Feb 21, 2012 at 8:03 PM, dguillett1 <dguille...@gmail.com> wrote:

> This will look in all sheets in the file and select if found. Put it in
> your DIR loop for all files in the folder.
>
> Sub lookinallsheets()
> For Each ws In Worksheets
> With ws
> Set mf = .Cells.Find(What:="**whattolookfor", LookIn:=xlValues, _
> LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext)
> If Not mf Is Nothing Then
> .Select
> mf.Select
> End If
> End With
> Next ws
> End Sub
>
>
>
>
> Don Guillett
> SalesAid Software
> dguille...@gmail.com
> -----Original Message----- From: Bob
> Sent: Monday, February 20, 2012 2:28 PM
>
> To: MS EXCEL AND VBA MACROS
> Subject: Re: $$Excel-Macros$$ Help with code please.
>
>
> There will never be more than 1 of the same number. I just need it to
> select the sheet that it's on and then select the cell where it's
> located. Thanks in Advance
>
> On Feb 19, 8:58 am, "dguillett1" <dguille...@gmail.com> wrote:
>
>> If you are saying you want to look for it on all sheets you can wrap in a
>> loop
>> for each ws in worksheets
>> ws.Select
>> Cells.Find(What:=**IndividualSearch,
>> LookIn:=xlValues,LookAt:=**xlWhole).Activate
>> next ws
>>
>> Or, are you saying there could be more than ONE hit?? BTW you don't need
>> to
>> select to work with the found item. More info??
>>
>> Don Guillett
>> SalesAid Software
>> dguille...@gmail.com
>>
>>
>>
>> -----Original Message-----
>> From: Bob
>> Sent: Sunday, February 19, 2012 6:33 AM
>> To: MS EXCEL AND VBA MACROS
>> Subject: $$Excel-Macros$$ Help with code please.
>>
>> I almost have the code the way I need it. BUT I want it to Find
>> everything within in the same Workbook, not just on the Index
>> Worksheet. Thanks in advance!!!
>>
>> Private Sub CommandButton1_Click()
>> Dim IndividualSearch As String
>> IndividualSearch = InputBox("What's the part number you're looking
>> for?", "Name Search entry box.")
>> If IndividualSearch = "" Then Exit Sub
>> On Error GoTo ErrorHandler
>> Worksheets("Index").Select
>> Cells.Find(What:=**IndividualSearch, LookIn:=xlValues,
>> LookAt:=xlWhole).Activate
>> Exit Sub
>> ErrorHandler:
>> MsgBox IndividualSearch & " not found.", 64, "No such animal."
>> End Sub
>>
>> --
>> FORUM RULES (986+ members already BANNED for violation)
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will
>> not get quick attention or may not be answered.
>>
>> 2) Don't post a question in the thread of another member.
>>
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>>
>> 4) Acknowledge the responses you receive, good or bad.
>>
>> 5)  Cross-promotion of, or links to, forums competitive to this forum in
>> signatures are prohibited.
>>
>> NOTE  : Don't ever post personal or confidential data in a workbook. Forum
>> owners and members are not responsible for any loss.
>>
>> ------------------------------**------------------------------**
>> ---------------­--------------**-------------
>> To post to this group, send email to excel-macros@googlegroups.com- Hide
>> quoted text -
>>
>> - Show quoted text -
>>
>
> --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5)  Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE  : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
> ------------------------------**------------------------------**
> ------------------------------**------------
> To post to this group, send email to excel-macros@googlegroups.com
> --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5)  Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
> NOTE  : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
> ------------------------------**------------------------------**
> ------------------------------**------------
> To post to this group, send email to excel-macros@googlegroups.com
>



-- 
Sam Mathai Chacko

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to