Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Searching a String

I have a list of ID numbers. They are as follows

bttest12
bttest45
cttest12
bttest45

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Searching a String

Thanks for the help
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help on sumproduct() - sum by searching for a common sub string in Eddy Stan Excel Worksheet Functions 12 March 29th 08 01:38 PM
Formula for searching for a text string KellyB Excel Discussion (Misc queries) 5 November 20th 06 09:20 PM
Searching for string in other cells Ruatha Excel Worksheet Functions 3 June 9th 06 10:42 PM
searching and summing using string within cell Al Excel Discussion (Misc queries) 2 April 26th 06 04:04 AM
searching a string with a partial string dcstech Excel Programming 1 April 5th 04 10:57 PM


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"