Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select order in Excel 2007 VBA Listbox

Status
Not open for further replies.

phudgens

Technical User
Jul 8, 2004
117
US
Does anyone know of a way to determine the order in which items in a Listbox were selected by the user?
 
I expect you could capture the ListIndex of the listbox during the On Change event like:
Code:
Private Sub lboMonth_Change()
    'assuming a label control names lblSelected
    Me.lblSelected.Caption = Me.lblSelected.Caption & Me.lboMonth.ListIndex & "~"
    Debug.Print Me.lboMonth.ListIndex
End Sub
This will stick the values as clicked. You might need to remove values that are clicked a second time and possibly add some weird character between the values.

Duane
Hook'D on Access
MS Access MVP
 
Thanks - that worked. I couldn't figure out how to get information back from the _Change event. I guess a label on the userform is the only way. I used a space for my weird character.
 
They don't - they're just the index of the selected items. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top