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
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

shades

Well-known Member
Joined
Mar 20, 2002
Messages
1,550
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?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
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.
 

P.J.C. Hausoul

New Member
Joined
Dec 23, 2004
Messages
28
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
 

P.J.C. Hausoul

New Member
Joined
Dec 23, 2004
Messages
28

ADVERTISEMENT

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
 

P.J.C. Hausoul

New Member
Joined
Dec 23, 2004
Messages
28
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,483
Messages
5,596,405
Members
414,064
Latest member
Duncthegreat

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
Top