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


Hi all,

I have a long list of part numbers in the format - '01821-00406'. I was
wondering if it is possible to have a text box on a form where the user
could enter a few digits of a part number then return a list of part
numbers containing the search string?

Thanks for any help!!

Joe @ work


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=512651

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search String within String


Would this work, have wrote the code but cant test it yet as form is not
built;


Code:
--------------------

i = 1
Do
If InStr(1, Cells(i, 1).Value, txtSearchString.Text) = True Then
'display numbers in datagrid
End If
i = i + 1
Loop Until Cells(i, 1).Value = ""

--------------------


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=512651

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Search String within String


Try something like this which will place list in a combobox:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Part = TextBox1.Value
ComboBox1.Clear
For Each cell In Worksheets("Sheet1").Range("A1:A100") <=== change
If cell Like Part & "*" Then
ComboBox1.AddItem cell.Value
End If
Next cell
End Sub

"gti_jobert" wrote:


Hi all,

I have a long list of part numbers in the format - '01821-00406'. I was
wondering if it is possible to have a text box on a form where the user
could enter a few digits of a part number then return a list of part
numbers containing the search string?

Thanks for any help!!

Joe @ work


--
gti_jobert
------------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...o&userid=30634
View this thread: http://www.excelforum.com/showthread...hreadid=512651


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search String within String


I've done it now, but for all those that want to know....this is how i
can be achieved;


Code
-------------------

Private Sub cmsSearch_Click()

Dim i%

ActiveWorkbook.Sheets("RelationalData").Activate
Range("A1").Select

i = 3
Do
If InStr(1, Cells(i, 7).Value, txtSearch.Text, vbTextCompare) < 0 Then
With lstResult
.AddItem Cells(i, 7).Value
End With
End If
i = i + 1
Loop Until Cells(i, 7).Value = ""

End Sub

-------------------

--
gti_jober
-----------------------------------------------------------------------
gti_jobert's Profile: http://www.excelforum.com/member.php...fo&userid=3063
View this thread: http://www.excelforum.com/showthread.php?threadid=51265

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
How to search a string from the right ? EuroMaverick Setting up and Configuration of Excel 2 March 28th 07 09:20 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
search a string withing a string : find / search hangs itarnak[_9_] Excel Programming 4 October 24th 05 03:19 PM
search for string within a string cretesupplies Excel Programming 2 October 11th 05 02:28 PM
VBA function : How to search a string in another string? bibi-phoque Excel Programming 5 April 19th 05 06:24 PM


All times are GMT +1. The time now is 06:27 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"