ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MultiSelect Listbox (Forms Toolbar) (https://www.excelbanter.com/excel-programming/305002-multiselect-listbox-forms-toolbar.html)

Ryan Holmes

MultiSelect Listbox (Forms Toolbar)
 
I am using a list box from the Forms Toolbar (i.e. NOT the
ActiveX one from the Control Toolbox). However I can find
no way, either through Excel itself or through VBA code,
to find out which items are selected if the list box is
set to "Multiple" or "Extend" mode. Extensive searches on
Google and the Microsoft site have come up with nothing.

Is this not possible to do? And if not, then why is the
option given to set the list box to anything other
than "Single" select mode?

Thank you muchly to anyone who manages to reduce my
increasing insanity over this issue.


Dave Peterson[_3_]

MultiSelect Listbox (Forms Toolbar)
 
I think you'll have to use VBA to get all the selected items.

I put a Button from the Forms toolbar and assigned this macro to that button:

Option Explicit
Sub btnClick()

Dim iCtr As Long

With Worksheets("sheet1").ListBoxes("list box 1")
For iCtr = 1 To .ListCount
If .Selected(iCtr) Then
MsgBox .List(iCtr)
End If
Next iCtr
End With

End Sub




Ryan Holmes wrote:

I am using a list box from the Forms Toolbar (i.e. NOT the
ActiveX one from the Control Toolbox). However I can find
no way, either through Excel itself or through VBA code,
to find out which items are selected if the list box is
set to "Multiple" or "Extend" mode. Extensive searches on
Google and the Microsoft site have come up with nothing.

Is this not possible to do? And if not, then why is the
option given to set the list box to anything other
than "Single" select mode?

Thank you muchly to anyone who manages to reduce my
increasing insanity over this issue.


--

Dave Peterson



All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com