This is driving me mad, any help would be appreciated.
I have a listbox (multi select) on a userform in Excel 2003. The userform is presented to the user with a quick find facility to save the user scrolling through the listbox if he wants. I can make the find facility select the item in the listbox no problem using this code :-
The problem is the listbox does not scroll to the newly selected item to show the user it has been found.
How can I force the listbox to scroll aswell as select the item the user wants.
I was thinking I could set the value which might do the job but I get an error message
"Runtime error 380: Could not set the value property. Invalid property value"
Any clues?
I have a listbox (multi select) on a userform in Excel 2003. The userform is presented to the user with a quick find facility to save the user scrolling through the listbox if he wants. I can make the find facility select the item in the listbox no problem using this code :-
Code:
Private Sub find_item_Click()
Dim item As String, counter As Long
item = InputBox("Please enter your item number")
With Menu
counter = 0
For Each lname In .ListBox3.List
If (lname = item) Then
.ListBox3.Selected(counter) = True
Exit Sub
End If
counter = counter + 1
Next lname
End With
End Sub
The problem is the listbox does not scroll to the newly selected item to show the user it has been found.
How can I force the listbox to scroll aswell as select the item the user wants.
I was thinking I could set the value which might do the job but I get an error message
Code:
.ListBox3.Value = .ListBox3.List(counter)
"Runtime error 380: Could not set the value property. Invalid property value"
Any clues?