List box show selected row

bugcatchup

New Member
Joined
Oct 7, 2005
Messages
17
I have a form open on the same page the data is on. The form has a listbox which is multi columned and contains many rows. I have a Search box that will search and find when you type in say, Br. It will find the 1st row that starts with Br. The problem is that since the list box is so long if the data being searched for and found is not already showing in the list box window, I have to manually scroll to it. How do I make the selected row show in the list box window without scrolling?

Thanks :confused:
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Is it the ListBox contents your are searching through or the data on the worksheet ?

If it is data on the worksheet, the corresponding row in the ListBox would probably be the worksheet row number - 1

eg: if your data was found on worksheet row 134,
ListBox1.ListIndex = (134 - 1)

If it is the listbox you search through, just set the ListBox.ListIndex to the row number that you found your data on.
eg:
Code:
Dim myText As String

myText = "whatever"
For i = 0 To ListBox1.ListCount - 1
    If UCase(ListBox1.List(i, 0)) = UCase(myText) Then
        ListBox1.ListIndex = i
        Exit For
    End If
Next i
 
Upvote 0
Hi, bugcatchup,

first of all I would experiment a bit with comboboxes,
they can scroll to the items you are typing in

would this do what you need ?
kind regards,
Erik
 
Upvote 0
I used a drop down validation list to filter all data into smaller categories. When the user selects a row of filtered data a macro copies and paste it to another sheet.

So right now it's doing everything I need it to do.


Thanks for your input again. :)
 
Upvote 0

Forum statistics

Threads
1,212,134
Messages
6,106,144
Members
447,998
Latest member
tippairie1

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