Avatar of allelopath
allelopath
 asked on

Default value for List Box Control

I've created a list box control in Excel 2010 and attached to some cell data. I'd like to give a default value, maybe just the first of the cells, but I don't see how to do that. Is this possible?
Microsoft Excel

Avatar of undefined
Last Comment
dlmille

8/22/2022 - Mon
dlmille

Is this a forms or active-x control?  If you've manually setup an active-x control, there's a Value property where you can type in the value (for your default selection).

If you have set the linked cell property to a cell in your worksheet, reflecting the outcome of the listbox selection, then you can set the value at that linked cell to the first row in your range.  By doing that, that will highlight the first item in your listbox as being selected.

However, once the user selects an item in the listbox, that linked cell will then be updated with that value.

See attached.

Dave
listbox-demo-r1.xls
Martin Liss

The list is zero-based so to, say, select the second item in the list, do

ListBox1.ListIndex = 1
dlmille

Good add - I had assumed the asker wasn't looking for a VBA solution.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
allelopath

ASKER
Its a form control. I should have attached a worksheet at first, didn't think of that. But now I've added to your file so you can see. Once you set it, its set, but at first its blank.
listbox-demo-r2.xls
SOLUTION
Martin Liss

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.