FInding Match in more than 1 cell

ManUBlueJay

Active Member
Joined
Aug 30, 2012
Messages
326
Office Version
  1. 365
Platform
  1. Windows
I need to find a given text in a cell in "myRange" and change the value 2 cells over. The first one is easy using Offset and match. Does any one have any Idea how to find the others. A little VBA script would also be fine as I would run it from a macro anyway.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It isn't clear whether "myRange" is a named range or a vba variable. I have assumed the latter.
You could try something like this

Rich (BB code):
Dim rFound As Range
Dim firstAddress As String

Set rFound = myRange.Find(What:="abc", LookIn:=xlValues, LookAt:=xlWhole)
If Not rFound Is Nothing Then
  firstAddress = rFound.Address
  Do
    rFound.Offset(, 2).Value = "new value" 'or whatever you want to with that cell 2 over
    Set rFound = myRange.FindNext(After:=rFound)
  Loop While rFound.Address <> firstAddress
End If

If "myRange" is actually a named range then change each myRange in the above code to Range("myRange")
 
Upvote 0
Thank You. Unfortunately "MY Range is a Named Range. Could you help me with that?
Thanks
 
Upvote 0
Thank You. Unfortunately "MY Range is a Named Range. Could you help me with that?
Thanks
I thought I already did. Did you read the text in my last post under the code box?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
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