How to determine Index Numbers for Multiple Items Selected in List

  • Thread starter Thread starter Gary S
  • Start date Start date
G

Gary S

Hi All,

How can I determine the Index Numbers for Multiple Items Selected in a List
Box
using vba code?
 
Dim strMessage As String
Dim varSelected As Variant

For Each varSelected In Me.List0.ItemsSelected
strMessage = strMessage & varSelected & ", "
Next varSelected

If Len(strMessage) > 0 Then
strMessage = Left(strMessage, Len(strMessage) - 2)
Else
strMessage = "Nothing selected."
End If

MsgBox strMessage
 
Doug,

You are amazing, it works great.

--
Thanks!
Gary S


Douglas J. Steele said:
Dim strMessage As String
Dim varSelected As Variant

For Each varSelected In Me.List0.ItemsSelected
strMessage = strMessage & varSelected & ", "
Next varSelected

If Len(strMessage) > 0 Then
strMessage = Left(strMessage, Len(strMessage) - 2)
Else
strMessage = "Nothing selected."
End If

MsgBox strMessage
 
Back
Top