Hello,
I have a vba user form with 1 combo box and 2 list boxes. Once the user makes a selection in ComboBox1 I want a corresponding set of cell values to populate the ListBox1. The user will then select one or more items from the ListBox1 which will get moved to ListBox2. Once moved to ListBox2 I want the items to be cleared (removed) from ListBox1 to help the user select more items if necessary.
For Example:
The user selects Colorado from a list of StateNames in ComboBox1, base on that selection ListBox1 is populated with all the counties in Colorado. The user then selects one or more counties from that list and moves them (with command button) to ListBox2. Once moved the selected items are removed from ListBox1 so they cannot accidentally be selected again and to make it easier to see remaining items in the list.
Initially I used a named range in the list box row source property, but have learned that you cannot clear selected items from a named range. What is another way to populate a list box with cell values in a specific column?
My data looks like this, but would have all 50 states and all counties listed:
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Colorado[/TD]
[TD="align: center"]Illinois[/TD]
[TD="align: center"]Arizona[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]San Juan[/TD]
[TD="align: center"]DuPage
[/TD]
[TD="align: center"]Navajo[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Quray[/TD]
[TD="align: center"]DeKalb[/TD]
[TD="align: center"]Apache[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Gunnison[/TD]
[TD="align: center"]Kane[/TD]
[TD="align: center"]Cochise[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Pitkin[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Coconino[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Custer[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Yuma[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Pueblo[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Las Animas[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]
I have a vba user form with 1 combo box and 2 list boxes. Once the user makes a selection in ComboBox1 I want a corresponding set of cell values to populate the ListBox1. The user will then select one or more items from the ListBox1 which will get moved to ListBox2. Once moved to ListBox2 I want the items to be cleared (removed) from ListBox1 to help the user select more items if necessary.
For Example:
The user selects Colorado from a list of StateNames in ComboBox1, base on that selection ListBox1 is populated with all the counties in Colorado. The user then selects one or more counties from that list and moves them (with command button) to ListBox2. Once moved the selected items are removed from ListBox1 so they cannot accidentally be selected again and to make it easier to see remaining items in the list.
Initially I used a named range in the list box row source property, but have learned that you cannot clear selected items from a named range. What is another way to populate a list box with cell values in a specific column?
My data looks like this, but would have all 50 states and all counties listed:
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Colorado[/TD]
[TD="align: center"]Illinois[/TD]
[TD="align: center"]Arizona[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]San Juan[/TD]
[TD="align: center"]DuPage
[/TD]
[TD="align: center"]Navajo[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Quray[/TD]
[TD="align: center"]DeKalb[/TD]
[TD="align: center"]Apache[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Gunnison[/TD]
[TD="align: center"]Kane[/TD]
[TD="align: center"]Cochise[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Pitkin[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Coconino[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Custer[/TD]
[TD="align: center"][/TD]
[TD="align: center"]Yuma[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Pueblo[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Las Animas[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[/TR]
</tbody>[/TABLE]