Search for text value in range
Tig, I don't know if this is what your looking for, but give this code a
shot.
hth , Rick
Sub FindDup()
Dim dupRng As Range, fndRng As Range
Dim x As Long
Set dupRng = Range("A7:A14")
x = 7 '' start row
Do Until IsEmpty(Cells(x, "C").Value)
Set fndRng = dupRng.Find(what:=Cells(x, "C").Value)
If Not fndRng Is Nothing Then
MsgBox ("Duplicate Found at = " & fndRng.Address)
Exit Sub
End If
x = x + 1
Loop
MsgBox ("No Duplicates Found")
End Sub
"tig" wrote in message
oups.com...
I'm looking for an efficient method to search for a text value. I have
a named range. Let's say range = A7:A14. I want to check cells C7:C14
to find the first cell whose value matches a previously populated
variable. It's possible that none of the cells have that value in it.
It seems that I could use a for all loop but I can't seem to get the
syntax right. I've already got a ton of named ranges. I'm trying to
avoid setting up a bunch more.
Any ideas??
TIA
|