omnibuster
03-25-2010, 01:52 PM
Hi.
Usually i use codes like this:
Private Sub Cmd2_Click()
Dim item As Long, I As Long, msg As String
With ListBox1
For I = 0 To .ListCount - 1
If .Selected(I) Then
msg = msg & .List(I) & vbNewLine
End If
Next I
End With
If msg = vbNullString Then
MsgBox "Nothing was selected! Please make a selection!"
Exit Sub
Else
End If
End Sub
But in case if i need only value= selected.items?
How (is it possibe) put work function like this:
varSelectedItems = Listbox1.Selected.Items.Count
MsgBox varSelectedItems
Usually i use codes like this:
Private Sub Cmd2_Click()
Dim item As Long, I As Long, msg As String
With ListBox1
For I = 0 To .ListCount - 1
If .Selected(I) Then
msg = msg & .List(I) & vbNewLine
End If
Next I
End With
If msg = vbNullString Then
MsgBox "Nothing was selected! Please make a selection!"
Exit Sub
Else
End If
End Sub
But in case if i need only value= selected.items?
How (is it possibe) put work function like this:
varSelectedItems = Listbox1.Selected.Items.Count
MsgBox varSelectedItems