Thread: Caontains.
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Caontains.

Hi THomas

One way, returns 0 for no match:

Sub test()
MsgBox FoundRow(Range("A:A"), "test2005")
End Sub

Function FoundRow(Rng As Range, Txt As String) As Long
On Error Resume Next
FoundRow = Rng.Find(What:=Txt, _
LookIn:=xlValues, _
LookAt:=xlPart, _
MatchCase:=False).Row
End Function

HTH. Best wishes Harald

"Tom" skrev i melding
...
Hello again,

how can I check it if hole column contains string which I am lookig for.

for example:
mystring = "test2005"
if mystring in column A give me number of this row

thanks tomas