View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
BHatMJ BHatMJ is offline
external usenet poster
 
Posts: 26
Default ListBox Click Event

The control is on a userform dialog box. It seems as if it should be
straight forward. Below is a code example:

Private Sub listbox1_Click()
'if any items in listbox1 are not selected, set "select all" checkbox to
false
For i = 0 to listbox1.ListCount - 1
If listbox1.Selected(i) = False Then
checkbox_all.Value = False
End If
Next
End Sub

"Steve" wrote:

xyz = Activesheet.ListBox1. Value
would put the selection into variable xyz for use in your code

"BHatMJ" wrote:

I have a listbox control on a user form in Excel. I want to add code
whenever an item in the listbox is selected/unselected. I assumed I could do
this in the "click" event of the list box. However, clicking on any of the
items in the listbox does not trigger the event. Can anyone help?