textbox input....listbox results

luke w

Board Regular
Joined
Oct 23, 2002
Messages
53
I'm a newbie at this VBA/Excel stuff, so I hope I don't come across too green.

I am trying to create a filtering system using an input from a textbox that will list results from two columns in a listbox in real time, not using a seperate search command button. The problem I'm having is that the keywords can be used for either column and can only return values associated with a particular cell. what I have is part numbers in one column and their associated description in the other. I would like to use the keyword search tool to allow the user to search either by a part number or a part of the description, and then return both associated cells to the listbox. Sound confusing? Anyway, if you excel gurus could help this greenthumb out that would be great. I found this code on this site, but I can't really understand how to modify it to do what I need.

Private Sub txtbxSEARCH_Change()
Dim Fst As String, cl As Range
lstbxRESULTS.Clear
If txtbxSEARCH.Value<> "" Then
Set cl = Sheets(2).Cells.Find(what:=txtbxSEARCH.Value, _
LookIn:=xlValues, lookat:=xlPart, MatchCase:=False)
If Not cl Is Nothing Then
Fst = cl.Address
Me.lstbxRESULTS.AddItem cl.Value
Do
Set cl = Sheets(2).Cells.FindNext(cl)
If Not cl Is Nothing And cl.Address<> Fst Then _
Me.lstbxRESULTS.AddItem cl.Value
Loop Until cl.Address = Fst
End If
End If
End Sub



_________________
Thanks
Luke
This message was edited by luke w on 2002-10-29 14:21
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top