conditional list in list box

Reset

Board Regular
Joined
Apr 16, 2010
Messages
227
Is there a way to have a conditional and updating list box? The list comes from another sheet column A, but I want the condition to only populate the list with values from column A if the corresponding cell in column B is blank. I run a macro where the selected items in the box will then get that cell in the second column filled in, thus the list box would decrease.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You can use this code at the end of macro that fills in the second column.

This macro deletes all the entries in the list box ListBox1 and then parses column B from row 1 to 10. If it finds that the Column B is blank, it will add the corresponding value in Column A in to the list box.


Code:
ct = ListBox1.ListCount - 1

For i = 0 To ct
        ListBox1.RemoveItem (ct - i)
Next

For i = 1 To 10
    If Cells(i, 2) = "" Then
        ListBox1.AddItem (Cells(i, 1))
    End If
Next
 
Upvote 0

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top