Link to home
Start Free TrialLog in
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?
Avatar of dlmille
dlmille
Flag of United States of America image

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
Avatar of Martin Liss
The list is zero-based so to, say, select the second item in the list, do

ListBox1.ListIndex = 1
Good add - I had assumed the asker wasn't looking for a VBA solution.
Avatar of allelopath
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
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial