Find and Search Macro

guguzera

New Member
Joined
May 12, 2016
Messages
5
Hi guys!

I need your help once again.

I would like to know if it's possible to create a Macro that is going to search a certain value (let's say it that this value is on cell E2). The value that i'm searching is in the middle of a text field (Imagine that I need to find the service order in the middle of a instruction text).

If the value is present in the worksheet of the instructions, I need to flag next to the searched value an OK, if not, I need to flag this value as "Not available".

Basically, what I need to do is a find (Crlt+f) and insert next to the number, an OK if that number is present in the other worksheet.

I totally lost in this. Could any of you please help me please?

Thank you so much in advance!!!!
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Here you go...
- amend sheet names

Goes in a standard module
Code:
Sub FindSomeText()
    Dim c As Range, what As String, addr As String
    what = CStr(Sheets("[I][COLOR=#800080]SheetWithValue[/COLOR][/I]").Range("E2").Value)
    With Sheets("[I][COLOR=#800080]SheetToSearch[/COLOR][/I]").UsedRange
        Set c = .Find(what, LookIn:=xlValues, LookAt:=xlPart)
        If Not c Is Nothing Then
            addr = c.Address
            Do
                c.Offset(, 1).Value = "ok"
                Set c = .FindNext(c)
            Loop While Not c Is Nothing And c.Address <> addr
        End If
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top