Multiselect list box
I dragged a list box from the Forms toolbar and drew it to
the size I wanted. I think I may have figured it out
though. This appears to work (testing the item with index
2 as an example):
Sub test()
Dim blnTemp As Boolean
ActiveSheet.Shapes("ListBox1").Select
With Selection
blnTemp = .Selected(2)
End With
End Sub
Many thanks for your comments.
-----Original Message-----
Sorry, I gave you code for a Forms listbox. How did you
create it?
--
HTH
RP
(remove nothere from the email address if mailing direct)
"ptaylor" wrote in
message
...
Bob,
I can't get it to recognize ListBox1. I get a "Method or
data member not found (Error 461)". Also, it looks like
a
I need a class module in order to use the Me object.
Thanks
ptaylor
-----Original Message-----
Here is some code as a starter
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Msgbox .List(i)
End If
Next i
End With
--
HTH
RP
(remove nothere from the email address if mailing
direct)
"ptaylor" wrote
in
message
...
I have created a list box on a worksheet and can set
its
properties in VBA as follows:
ActiveSheet.Shapes
("ListBox1").ControlFormat.ListFillRange
= "B5:B8"
ActiveSheet.Shapes
("ListBox1").ControlFormat.MultiSelect
= xlExtended
How do I determine the list items that have been
selected?
The .Selected(index) (boolean) property is not a
property
of the ControlFormat object.
TIA
P Taylor
.
.
|