ListIndex current combobox value without highlighting

In VBA, the ListIndex Combobox property shows the index (starting at 0) of the item selected in the general list (array) of values ​​in Combobox. It shows -1 if no selection is made.

When I pop up a sheet in Excel using Combobox and the last value in it, it gets ListIndex from -1 instead of the actual ListIndex element.

What is the trick in VBA to quickly get ListIndex of the current value not selected?

I know that I can manually check the array myself (.List property), but I hope VBA has a faster way to do this.

+3
source share
1 answer

From VBA help in ListIndex :

ListIndex . ListIndex -1 , ( ListCount - 1). selected, ListIndex -1. ListBox ComboBox, ListIndex.

, , , . , ListIndex -1.

+1

Source: https://habr.com/ru/post/1756043/


All Articles