So, I have an ActiveX ListBox control named ListBox1 on Sheet1 of my Excel Workbook. I enabled multiple selections on it.
I also put some code in the Sheet1 Object:
Private Sub ListBox1_Change()
Debug.Print "hello world"
End Sub
Now, if I select three values in my listbox, I see "Hello world" three times in my immediate window. So I guess the Change event triggers correctly.
When I select any cell on the same sheet where my listbox is, and I do something with it (e.g. I type "ABCDE" in it, or I press Delete) the selection I made in the listbox goes blank.
So if I had the first value in the list selected, and then I click cell "A1", type "Hello" in it and press Enter, the very moment I hit the key the first value is unselected from the listbox.
Why the hell is this? This is driving me crazy. Is the Listbox1_Change event not working properly?
It's funny though, because I don't see an extra "Hello world" in the immediate window, so I guess the event didn't actually trigger...
Any thought?