Thread: VBA searching
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default VBA searching

Different approach

Dim iRow As Long
On Error Resume Next
iRow = ActiveSheet.Evaluate("Match(""HelloFred"", B1:B100&C1:C100, 0)")
On Error GoTo 0
If iRow 0 Then
MsgBox "Found in Row " & iRow
End If


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"kirkm" wrote in message
...
Hi Guys,

I've got to grips with this - which finds the first occuarnce
of 2 in range A1:A500.

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
End If
End With

(Thank you Bob)

However if I had two cells side by side e.g

B3 = "Hello" D3 = "Fred"

And I have "HelloFred" to search for - wanting the 3 returned (I
already know the columns), can that be acheived in a similar manner
to the above?

Many thanks - Kirk