ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List Box and Quick selecton of item in drop down (https://www.excelbanter.com/excel-programming/290928-list-box-quick-selecton-item-drop-down.html)

Katie412

List Box and Quick selecton of item in drop down
 
This may be a real simple issue, but I am, unforutnately, not that savy
with VBA and the help isn't helping on this one.

I have a list box whose drop down menu contains a set of states.
for example:

Arizona
California
Utah
Washington
Wisconsin

Currently, if the user wishes to select Wisconsin they must scroll to
the bottom of the list. In other applications I have seen on the web,
the user could type "W" and the drop down menu would automatically
access Washington, the 1st state with a W. Is anyone familiar with a
function that can be built into a listbox?

Thanks,
Katie


---
Message posted from http://www.ExcelForum.com/


Markus Grein

List Box and Quick selecton of item in drop down
 
"Katie412 " wrote in message
...
This may be a real simple issue, but I am, unforutnately, not that savy
with VBA and the help isn't helping on this one.

I have a list box whose drop down menu contains a set of states.
for example:

Arizona
California
Utah
Washington
Wisconsin

Currently, if the user wishes to select Wisconsin they must scroll to
the bottom of the list. In other applications I have seen on the web,
the user could type "W" and the drop down menu would automatically
access Washington, the 1st state with a W. Is anyone familiar with a
function that can be built into a listbox?

Thanks,
Katie



Hi Katie !

Quite frankly, that's exactly how a listbox is supposed to work in VBA. Have
verified it with short example that I set up on my machine. I added a
ListBox to a UserForm, and added entries to that list like below (not very
elegant, but it works ...) :

Me.ListBox1.AddItem("Arizona")
Me.ListBox1.AddItem("California")
etc.etc.

And when you get the UserForm into "run" mode, click on the listbox and
press the "W" key, the selection *does* jump to Washington. In fact, this
works for both, ListBox and ComboBox controls - given the case that the
control *does* have the focus at the time you press the respective key.

cheers,
Markus




onedaywhen

List Box and Quick selecton of item in drop down
 
Take a look at the ListBox's MatchEntry property e.g. set it to
fmMatchEntryFirstLetter.

--

Katie412 wrote in message ...
This may be a real simple issue, but I am, unforutnately, not that savy
with VBA and the help isn't helping on this one.

I have a list box whose drop down menu contains a set of states.
for example:

Arizona
California
Utah
Washington
Wisconsin

Currently, if the user wishes to select Wisconsin they must scroll to
the bottom of the list. In other applications I have seen on the web,
the user could type "W" and the drop down menu would automatically
access Washington, the 1st state with a W. Is anyone familiar with a
function that can be built into a listbox?

Thanks,
Katie


---
Message posted from http://www.ExcelForum.com/


Katie412[_2_]

List Box and Quick selecton of item in drop down
 
Thank you for your tips!! I will give it a shot.

Katie :-)


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com