0

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):

enter image description here

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.

1
  • have you thought of using a ComboBox that references a Table with the Names instead of a range of cells? Then you could just use the .RowSource on the BeforeDoubleClick event. Commented Dec 21, 2018 at 18:09

1 Answer 1

1

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"

Sign up to request clarification or add additional context in comments.

1 Comment

Glad I could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.