I need a list/combo box that can be linked to many cells.


Posted by DEY on September 21, 2001 8:02 AM

I've tried data validation lists, forms combo and list boxes, and controls combo and list boxes. Each has something I want, but I am not able to get any of them to do everything I want. I'd like to have a drop-down box or a multi-list UserForm that can be used to make individual selections for many different cells. I want the combo/list box to contain 3 different columns, with the selection from each column going in a different cell, or perhaps being concatenated into one cell - I've not decided which is best yet, since I may have to (at some future time) use the selected values in another worksheet or workbook. Further, I want one of the columns in the list to display one thing, but return a different value to the cell. Here's an example of how I want the box/list arranged:

WORK PERFORMED LOCATION HOURS
clean top to bottom 4248 10.75
defrost refrigerator 1120 2.5
wash windows 3155 4.5
mildew removal 2876 3

Here is how I want the selections to be displayed in the cell(s):
WORK PERFORMED LOCATION HOURS
CTTB 4248 10.75
DEFR 1120 2.5
WSHW 3155 4.5
MLDW 2876 3

I want the user to be able to click on one button at the top of a worksheet, make any combination of choices from the three columns, and have those choices displayed in the appropriate cell(s) for that particular day. Each day (Monday - Sunday) will have four areas in which to record each of the above selections...In other words, all four of the above selections could be recorded in just one day.

Also, I have no idea how to ensure that the information will end up in the correct cell, short of clicking on the cell prior to clicking on the list button.

I sure hope someone can help with this, as I am at a loss.

Thanks For Your Time,
DEY



Posted by Damon Ostrander on September 24, 2001 12:48 AM

Hi DEY,

Check into the List Property of the combo/list box control. With it you can eliminate the need to directly assign a cell range to fill the list and take control of how items appear in the list. The list essentially becomes a VBA array, and you can fill this array any way you want--from cells, from a file, from user inputs, etc. You can also take control in VBA of what happens when the user selects an item. The currently selected item is identified by the ListIndex property of the control, and its value is given by the Value property. You can use this information to map the selections into the worksheet that displays the results.

I hope this helps.

Damon