Thread: Find a string
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Find a string

Sub zTest()
Dim sDname as String, r as Range, r1 as Range
sDName = "D01-007"
set r = Range(Cells(6, 2), Cells(30, 2))
set r1 =r.Find(sDName)
if not r1 is nothing then
msgbox r1.address
else
msgbox "Not found"
End if




End Sub


Regards,
Tom Ogilvy


"Francis Hookham" wrote:

I am trying to find the row in which a string occurs but I just do not
understand how.
Can you complete this for me?

Sub zTest()

sDName = "D01-007"

iDRow = .Find(sDName, LookIn:=Range(Cells(6, 2), Cells(30, 2)))

End Sub

Francis Hookham