Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Multiselect list box

I have created a list box on a worksheet and can set its
properties in VBA as follows:

ActiveSheet.Shapes("ListBox1").ControlFormat.ListF illRange
= "B5:B8"
ActiveSheet.Shapes("ListBox1").ControlFormat.Multi Select
= 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Multiselect list box

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.ListF illRange
= "B5:B8"
ActiveSheet.Shapes("ListBox1").ControlFormat.Multi Select
= 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Multiselect list box

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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Multiselect list box

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



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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


.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Multiselect list box

Sorry I misled you. Glad you sorted it.

Bob


"ptaylor" wrote in message
...
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


.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I have a multiselect option for a list box in excel 2003 pascaleinlove Excel Discussion (Misc queries) 1 March 15th 10 06:41 PM
How do I create a multiselect drop down list Yve Excel Worksheet Functions 2 January 22nd 09 07:29 PM
Multiselect Listbox Francis Ang[_3_] Excel Programming 0 October 27th 04 02:21 AM
multiselect listbox CG Rosén Excel Programming 2 December 28th 03 05:17 PM
Multiselect Boxes Jase Excel Programming 2 October 22nd 03 03:40 AM


All times are GMT +1. The time now is 10:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"