listboxes

M

Mandy

I have a 3 listboxes, the items in which the user can
click. How can I get make it so that if an item is
clicked in listbox1 then selected items in listboxes 2 &
and 3 are deselected?

Many thanks
 
B

Bob Phillips

Hi Mandy,

Is this what you mean?

Private Sub ListBox1_Click()
Me.ListBox2.ListIndex = -1
Me.ListBox3.ListIndex = -1
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Todd Huttenstine

below code does what I think you need....
To test, paste this entire code in a commandbutton.

Private Sub CommandButton1_Click()
Dim LB1Vals
Dim LB2Vals
Dim LB3Vals


With Worksheets("Worksheet Name Here").ListBox1
For LB1Vals = 0 To .ListCount - 1
If .Selected(LB1Vals) Then
MsgBox "There is an item or items selected
in ListBox1"
'Clears all checks from Listbox2 and
Listbox3
With Worksheets("Worksheet Name
Here").ListBox2
For LB2Vals = 0 To .ListCount - 1
.Selected(LB2Vals) = False
Next LB2Vals
End With
With Worksheets("Worksheet Name
Here").ListBox3
For LB3Vals = 0 To .ListCount - 1
.Selected(LB3Vals) = False
Next LB3Vals
End With
Exit Sub
Else
End If
Next
End With
MsgBox "There were no items selected in ListBox1"
End Sub


Todd Huttenstine
 
Top