View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Search cell for string

Try this:

Sub arneee()
Dim expression As String, v As String
expression = "G BP730 080708_88571"
Set r = Intersect(Range("A:A"), ActiveSheet.UsedRange)
For Each rr In r
v = rr.Value
If InStr(expression, v) 0 And Len(v) 0 Then
MsgBox (rr.Address & Chr(10) & rr.Value)
Exit Sub
End If
Next
End Sub

--
Gary''s Student - gsnu200754


"Arne Hegefors" wrote:

Hi! I search column A in an excel file fo ra certain expression. The
expression might look like: G BP730 080708_88571. However the cell I am
trying to locate will only contain part of this string eg G BP730 080708. How
can I do this? Many thanks!