multi -selection list boxes

  • Thread starter Thread starter Theresa
  • Start date Start date
T

Theresa

I am trying to do a multi-selection list box it needs to
be done in VBA. I have never used VBA can anybody help?
Thanks
 
Theresa:

What are you trying to do with a multi-select list box? Determine what is
selected? If so here's one way to approach the code:

Dim objCtrl as Control
Dim intCount as Integer, i as Integer
Set objCtrl = Me!MyListBoxControl
intCount = objCtrl.ListCount
For i = 1 to intCount 'Use intCount -1 if you have included row headers
If Ctrl.Selected(i) = True Then
'Do Something
End If
Next i

Another way is similar:

Dim objCtrl As Control
Dim objItem As Variant
Set objCtrl = Me!MyListBoxControl
For Each objItem In objCtrl.ItemsSelected
'Do Something
Next objItem
 
Back
Top