View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey[_2_] Mark Ivey[_2_] is offline
external usenet poster
 
Posts: 171
Default Find exact text match

See if this works right...

Set Rng = Range("AA1:AA30")
With Rng
For N = 15 To 42
Set c = .Find(Cells(N, 14).Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
'----STATEMENTS
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
Next
End With



Mark

"Graham" wrote in message
...
I am having a problem with the part of a procedure below in that I want it
to find an exact match and it does not do that. For example Cells(n,14) at
any point may have SB and the loop is picking up NF-TSB in Rng. I would
value any guidance.

Set Rng = Range("AA1:AA30")
With Rng
For N = 15 To 42
Set C = .Find(Cells(N, 14).Value, LookIn:=xlValues)
If Not C Is Nothing Then
firstAddress = c.Address
Do
----STATEMENTS
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
Next
End With

Kind Regards,
Graham