ComboBox Activation on WorkSheet

gtvkeith

Board Regular
Joined
Mar 15, 2006
Messages
78
Hi everyone,

I have just 'graduated' to Excel 2010 and boy, has it made life 'Interesting'!

I need help with an 'ActiveX' ComboBox located on a worksheet.

I am using it to activate AutoFilters on the worksheet, using a list of over a thousand names as reference.

My problem is that unlike a ComboBox on a UserForm the ComboBox Activates as soon as a unique 'value' is entered rather than waiting for the user to hit the enter key. Also if the user pauses too long while typing the name it will begin re-entering the value.

Does anyone know how to force the ComboBox to wait for the user to hit enter? I still want it to 'match' the values actively against the reference list though.

I have already changed its code to _Click() rather than _Change().

Thanks,

Keith.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
I am still having the problem stated above but have now determined that as soon as I add code to the ComboBox this issue presents itself.

All I did was put in a messagebox to tell me when the control triggers. But I still dont know why it works differently just because there is code behind it.
 
Upvote 0
Hi,

Maybe you are using the wrong control. A ComboBox is normally used to a user select a value from a pre-defined list (yes, is possible to Enter a new value in a ComboBox but i would not recommend this kind of use)

Have you thought about a TextBox and a CommandButton that would be pushed after the user had completed the entry in the text-box?

M.
 
Upvote 0
Maybe something along these lines :

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

    If KeyCode = vbKeyReturn Then
        'do your stuff here.
    End If

End Sub
 
Upvote 0
Hi Marcelo, thanks for the reply.

I have a pre-defined list that is populating the ComboBox, currently 2,500 names.

My problem (I am used to working with ComboBoxes in Forms) is that with the ComboBox on the worksheet, as soon as I add code to the ComboBox, it's behaviour changes.

As soon as a unique entry from the list is typed (but not entered) the ComboBox activates, if the user is not aware this has happened and continue to type, they start entering data in whatever cell on the sheet has just become active.

Also if they pause while typing in the name (trying to remember how it is spelt) when they keep typing, the ComboBox treats this 'new' text as a new entry and starts filling the ComboBox again overwriting what was previously being typed.

What I am trying to do is get the ComboBox to behave just as it would in a UserForm.

I hope this clarifies my issue.
 
Upvote 0
Hi Jaafar,

Your code lets me keep typing without the ComboBox activating, but now I cannot get the ComboBox to activate at all.
 
Upvote 0
I apologise, it does work. I am having some further issues with the code in my ComboBox. But I can tell this code is working.

Thankyou very much both of you for your help.
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,823
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top