ActiveX ComboBox Clears Itself After Entry Selection

BruceMar
NewLounger
Posts: 3
Joined: 07 Aug 2020, 18:14

ActiveX ComboBox Clears Itself After Entry Selection

Post by BruceMar »

Simple ActiveX Combobox with listfillrange of a list in another sheet (same workbook).

Dropdown works.
I choose item.
Linked cell shows correct contents.
Dropdown closes and selected entry DOES NOT appear as choice. I have to use dropdown again, see only the one choice (it is dynamic so the choices get less) and click it again for it to stay in the selection field.

PDF shows best where the middle blue box should show selection

No VBA coding.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78379
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ActiveX ComboBox Clears Itself After Entry Selection

Post by HansV »

Welcome to Eileen's Lounge!

I'll take a look soon.
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78379
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ActiveX ComboBox Clears Itself After Entry Selection

Post by HansV »

Let's say you select the second item: AAA Sheri (Test@yahoo.com). This item comes from cell W3 on the Source sheet.
Selecting this item sets the linked cell to 2, and this in turn changes the contents of column W on the Source sheet.
The only non-blank item is now AAA Sheri (Test@yahoo.com) in cell W2 instead of W3. But the linked cell still contains 2!
However, if you were to set the linked cell to 1, this would change column W again.

In short: what you're trying to do is too complicated.
Best wishes,
Hans

BruceMar
NewLounger
Posts: 3
Joined: 07 Aug 2020, 18:14

Re: ActiveX ComboBox Clears Itself After Entry Selection

Post by BruceMar »

Is there an easier way to have a dropdown combobox that I can type a couple of letters and see all the matches in the dropdown, then select one of those choices and have that choice remain in the entry box?

Thank you for your time!

BruceMar
NewLounger
Posts: 3
Joined: 07 Aug 2020, 18:14

Re: ActiveX ComboBox Clears Itself After Entry Selection

Post by BruceMar »

What do you mean "Selecting this item sets the linked cell to 2?"
The linked cell is C6 and that correctly becomes the selection (in your example: AAA Sheri). I am a newbie so I am probably confused. But I don't understand the sentence.

User avatar
HansV
Administrator
Posts: 78379
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: ActiveX ComboBox Clears Itself After Entry Selection

Post by HansV »

My apologies - I was confusing ActiveX combo boxes and Form Controls combo boxes. The combo box does indeed enter the text in the linked cell, not its index number.

But as far as I can tell, the problem is related to the index number: internally, the combo box keeps track of the selected item through its ListIndex property.
If nothing has been selected, ListIndex = -1.
If the first item is selected, ListIndex = 0.
If the second item is selected, ListIndex = 1, etc.

So when you select the second item AAA Sheri (Test@yahoo.com), ListIndex is set to 1.
But the contents of the ListFillRange change - now AAA Sheri (Test@yahoo.com) is the first item, and the second item is blank.
Since the ListIndex is still set to 1, the second - blank - item is shown.

But I might be wrong, and it's simply because the contents of the ListFillRange have changed.
Best wishes,
Hans