View Full Version : [SOLVED:] Goto a specific part of a list
austenr
04-28-2005, 12:52 PM
I have a userform with a scroll bar that allows the user to scrool to the row they want. Potentially there will be thousands of rows of data. Is there a way to jump to a specific part of the list say the ones starting with "G"? Thanks
lucas
04-28-2005, 01:21 PM
austenr,
I may be wrong but I think you can add a textbox(textbox2 in my example) and use this code on it:
Private Sub TextBox2_Change()
Dim Search As String
Dim n As Long
Dim i As Long
Dim j As Long
Search = Me.TextBox2.Text
n = Len(Me.TextBox2)
j = Me.lstSelection.ListCount - 1
For i = 0 To j
If Left(Me.lstSelection.List(i), n) = Search Then
Me.lstSelection.Selected(i) = True
Exit For
End If
Next
End Sub
lstSelection is the name of your listbox. change those two things to match your listbox and textbox. then when you type the first letter in the search(textbox) it will go there immediatly. Works for me
austenr
04-28-2005, 02:12 PM
Thaks that worked great!!
lucas
04-28-2005, 02:35 PM
Your Welcome,
Glad it works as well for you as it did for me.
Thats one of many I have pilfered from this forum in the past.
You can mark this one solved then?
austenr
04-28-2005, 04:11 PM
yep
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.