List Box on worksheet
Private Sub CommandButton1_Click()
Dim lbox As MSForms.ListBox
Set lbox = Worksheets("jpegs"). _
OLEObjects("ListBoxMain").Object
For i = 0 To lbox.ListCount - 1
If lbox.Selected(i) Then
sStr = sStr & lbox.List(i, 0) & vbNewLine
End If
Next
MsgBox sStr
End Sub
--
Regards,
Tom Ogilvy
Stuart wrote in message
...
I just cannot get this to work, the only thing that I can do is select it
with the following line
Worksheets("jpegs").Shapes("ListBoxMain").Select
I cannot refer to it as **Worksheets("jpegs").ListBoxMain**
Tom Ogilvy wrote in message
...
Same as when located on a Userform
Private Sub CommandButton1_Click()
With Worksheets("sheet1")
For i = 0 To .ListBox1.ListCount - 1
If .ListBox1.Selected(i) Then
sStr = sStr & .ListBox1.List(i, 0) & vbNewLine
End If
Next
End With
MsgBox sStr
End Sub
--
Regards,
Tom Ogilvy
Stuart wrote in message
...
Working with a List Box that is situated on a worksheet, (NOT in a
Dialog
or
UserForm)
how do I get the entries selected when on MultiSelect?
|