Link to home
Start Free TrialLog in
Avatar of szadroga
szadrogaFlag for United States of America

asked on

Excel Combo Box pressing Enter to complete action

I am using an ActiveX Control Combo Box that references a list in the sheet.  Autocomplete is enabled and working well.  The issue I am having is that when I start typing the first few letters of the item on the list, I see the rest of the item description from the autocomplete but I cannot hit enter to finish populating the Combo Box with the remaining untyped letters.
For example (my list is names)

I type in “Joh” and the autocomplete displays “John Doe.”  So I can see autocomplete is working properly, but when I see “John Doe” after just type the first 3 letters (“Joh) I can’t hit enter to accept the autocomplete selection.

I would like to be able to hit enter and the entire name be populated in the Combo Box.
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Can you attach your workbook or a demo workbook that shows the problem?
Avatar of szadroga

ASKER

attached is a sample
I guess I don't understand what you want to have happen that's not already happening. When I type "Joh" it shows me "John Doe" and cell A1 also shows it. Isn't that what you want?
Is it that you don't want the choice to show up in A1 until you press Enter? If so then blank out the combo's LinkedCell property and add this bit of code.


Private Sub ComboBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = vbKeyReturn Then
        Range("A1").Value = ComboBox1.Text
    End If
    
End Sub

Open in new window

if you begin to type "joh" the name "john doe" appears but when you hit enter the highlighting remains so it seems like Enter action does not take affect.

i have another spreadsheet where once you select a name from the combo box a table reflects data based upon your selection.  It would make it much easier if I could just hit Enter and the selection would take effect.
Try my suggestion and code in my previous post.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Did that work for you?
I'm glad I was able to help.

Marty - MVP 2009 to 2013