View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Searching a String

Try this

With Worksheets("Sheet1")
On Error Resume Next
Set oCell = .Range("A1:A50").Find(what:="ct", lookat:=xlPart)
If Not oCell Is Nothing Then
sFirst = oCell.Address
Do
.listboxes("List Box 1").additem oCell.Value
Loop While Not oCell Is Nothing And oCell.Address < sFirst
End If
End

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"dcstech" wrote in message
...
I have a list of ID numbers. They are as follows:

bttest123
bttest456
cttest123
bttest456

Ok in VBA say that i wanted to search this row of strings using a short

segment of the strings.

Inputbox1="ct"

I would like to return the values that contain the letters "ct" to a

listbox.

Thanks for any help.