bradyboyy88
Well-known Member
- Joined
- Feb 25, 2015
- Messages
- 562
So I have created a similar filter feature on a userform that imitates that used in excel when you do the filter feature. My code creates a frame with a listbox that fills the listbox with a bunch of items and when the user selected the ones to filter on and hits submit it loads these selected items into a collection. Well when you rehit the filter button to show the frame I wanted it to reselect the items in the listbox from the collection. The code works as expected and does return true correctly when looping through the listbox contents (using doesitemexist function) but for some reason I cannot highlight the item and returns false in message box since its not highlighted. Here is the code:
Code:
Private Sub HighlightCollectionItems(ByRef coll As Collection)
If coll Is Nothing Then Exit Sub
Dim X As Integer
For X = 1 To FilterBoxListbox_BROWSE.ListCount - 1
If DoesItemExist(coll, FilterBoxListbox_BROWSE.List(X)) Then
FilterBoxListbox_BROWSE.Selected(X) = True
MsgBox FilterBoxListbox_BROWSE.Selected(X)
End If
Next
End Sub
Last edited: