How to determine Index Numbers for Multiple Items Selected in List

G

Gary S

Hi All,

How can I determine the Index Numbers for Multiple Items Selected in a List
Box
using vba code?
 
D

Douglas J. Steele

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
 
G

Gary S

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top