View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Multi listbox change event - selected or deselected

I forgot to tell you that the solution given before is ok if the MultiSelect property = fmMultiSelectMulti

--
isabelle

Le 2011-04-23 23:48, isabelle a écrit :
hi,

Code:
 Dim x As Integer

 Private Sub ListBox1_Change()
 Dim i As Integer, n As Integer

 For i = 0 To ListBox1.ListCount - 1
 If ListBox1.Selected(i) = True Then n = n + 1
 Next i

 If n  x Then
 x = x + 1
 MsgBox "select"
 Else
 x = x - 1
 MsgBox "deselect"
 End If

 End Sub