Reputation: 155
I'm using Excel 2013. I have a "BeforeDoubleClick" event that shows a userform with some listboxes. The user double clicks any cell and the userform intializes and populates the listboxes, however when the userform is launched the listbox shows a couple of the items as highlighted (already selected, even though I haven't selected anything yet):
This is the code to load the listbox when userform is initialized:
For Each cel In rng.Cells
With cel
If .Value <> "" Then
lstPEOPLE.AddItem .Value
End If
End With
Next cel
Obviously the listbox should be clear of any selections on initialization. This doesn't happen all the time - it seems to happen when randomly double-clicking cells. Thoughts?
Thank you.
Upvotes: 0
Views: 794
Reputation: 706
If you set all of the names in that list to a table you could just use the following code in the BeforeDoubleClick
event:
lstPeople.RowSource="Insert Table Name Here"
Upvotes: 1