Multiple listbox, can only select 1 entry

Jean-Francois

New Member
Joined
Jul 23, 2009
Messages
27
Hi,

On a userform I have 4 listbox (listbox1 - listbox2 - listbox3 -listbox4)

All my listbox are configure as singleselection but what I would like is a single select for all the listbox.

Like if I select an entry in Listbox1 and after I decide to pick one in listbox2 then the one in Listbox1 get unselected.

All the listbox would act like a group.

Is it possible ?
 

Some videos you may like

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

doofusboy

Well-known Member
Joined
Oct 14, 2003
Messages
1,325
Theoretically it should be possible. I would think that you could write code to deselect items in the other three list boxes each time a choice is selected in a given list box. Of course, you would need this code for each list box. Something like this should work for you.

Code:
Private Sub ListBox1_Click()
Dim intCtr As Integer
    For intCtr = 0 To ListBox2.ListCount
        ListBox2.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox3.ListCount
        ListBox3.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox4.ListCount
        ListBox4.Selected(intCtr) = False
    Next intCtr
End Sub
Private Sub ListBox2_Click()
    For intCtr = 0 To ListBox1.ListCount
        ListBox1.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox3.ListCount
        ListBox3.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox4.ListCount
        ListBox4.Selected(intCtr) = False
    Next intCtr
End Sub
Private Sub ListBox3_Click()
    For intCtr = 0 To ListBox2.ListCount
        ListBox2.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox1.ListCount
        ListBox1.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox4.ListCount
        ListBox4.Selected(intCtr) = False
    Next intCtr
End Sub
Private Sub ListBox4_Click()
    For intCtr = 0 To ListBox2.ListCount
        ListBox2.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox3.ListCount
        ListBox3.Selected(intCtr) = False
    Next intCtr
    For intCtr = 0 To ListBox1.ListCount
        ListBox1.Selected(intCtr) = False
    Next intCtr
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,559
Messages
5,596,836
Members
414,107
Latest member
Tigretto

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
Top