Reputation: 1872
I found this question... EASY: vba: Looking through a listbox and selecting the contents but it seems to select every item...not very useful.
I need to load a popup form's ListBox with the existing values already highlighted so that the user will be able to add or remove items.
For x = 1 To rs.RecordCount
For Each ItemIndex In lbFA.?????
If lbFA.ItemData(ItemIndex) = rs!FunctionalArea Then
lbFA.Selected(ItemIndex) = True
End If
Next y
Next x
What goes in the lbFA.?????
area? I think that's the only part I missing.
Upvotes: 1
Views: 734
Reputation: 5917
you can perform a standard for loop for ItemIndex = 0 to lbFA.listCount -1
. This way you can get values from different column too if in case multi column listbox > lbfa.column(col_id, ItemIndex)
Upvotes: 1