Dropdown listbox behavoirs

P.J.C. Hausoul

New Member
Joined
Dec 23, 2004
Messages
28
Hello ,

I have two problems i don't know how to solve . I've created a combobox that is formatted as a dropdown listbox so users can only select predefined items. This works fine , but i'm not satisfied with the behavoir of this control . I want the user to be able to use the enter key in all the controls so that it will jump to the next control in the tab order. This seems to work only for text box controls . So my first question is :

Is it possible to change the focus (tabindex) by pressing enter , when using a combobox ? (normally this is done by pressing the Tab key)

Next i want the dropdown list to automatically drop down and display the full list of items when the control recieves the focus. I know the user can click the arrow and the list will drop, but i want to reduce the use of the mouse . This is for a faster way of entering data. So my second question is:

Is it possible to automatically make the dropdown listbox 'drop down' once it has the focus ?

Thanks in advance for any thought on these questions.
Cheers
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Regarding the second issue: in a combobox list, selecting the first letter will automatically take the person to the first listed item that begins with that letter, and as the user keeps typing narrows that down. Is that not working/helpful?
 
Upvote 0
How have you created the dropdown?

Is it on a worksheet or userform?

If it's on a userform then you can set the Style property to 2- fmStyleDropDownList to show the full list.

And you can check if Enter has been pressed using the control's KeyPress event.

The above may also apply to controls taken from the Control Toolbox toolbar.
 
Upvote 0
Well to answer your questions :

Yes the dropdown is on a userform .Maybe if you had read a bit more carefully you would have noticed that í was speaking about a combobox which is a userform control (no offence intended). And yes i've noticed that there is a style property (which solely determines wether or not data can be altered when the userform is running). But i thought i had already stated in my initial post , that i'm using the dropdownlistbox setting. this however still leaves my initial question :

Is it possible to make the dropdown list automatically drop once it recieves the focus ?

Next , thanks for the insight on the enter key issue , ( a little piece of code would be greatly appreciated, but i will try to figure it out myself)

Cheers
 
Upvote 0
Well i found a way to make the focus change by pressing enter :

Code:
Private Sub Control1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = vbKeyReturn Then
Control2.SetFocus
End If
End Sub
 
Upvote 0
And the second problem has been solved aswell , quite simple actually :

Code:
Private Sub Combobox_Enter()
Combobox.DropDown
End Sub

Thanks for nothing @!$@ , no just kidding
Cheers
 
Upvote 0
combobox which is a userform control
It is also available from the Forms and Control Toolbox toolbars.

And a sort of combobox can be created using Data>Validation.

And yes i've noticed that there is a style property (which solely determines whether or not data can be altered when the userform is running).

As far as I know that is not the case.

the dropdownlistbox setting
What setting is this? It's not listed in the Properties window of the combobox.

There is a method Dropdown which I see you have utilised.

BTW before posting my original reply I did some testing to make sure I was givibg the correct information.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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