Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / January 2007

Tip: Looking for answers? Try searching our database.

Multiple selections in Listbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christiaan - 27 Jan 2007 17:02 GMT
I have 2 Excel VBA questions:
1) Is it possible to choose multiple items in a List Box and if so, 2) how
can I use those selected items in a macro (which variable type should I
use?)

For example. I have selected three country in a listbox and I want to print
the sales results of each of those three countries. Asume in this case that
I use for each country one worksheet.

Your suggestions and tips are very appreciated! Thanks!

Best regards,

Christiaan
Zack Barresse - 27 Jan 2007 19:59 GMT
Hi there,

It depends on what kind of listbox you have created.  If you have created
one from the Controls Toolbox menu (an ActiveX control), you could use
something like this ...

Sub PrintListBoxSheets()
   Dim i As Long
   With Sheet1.ListBox1
       For i = 0 To .ListCount - 1
           If .Selected(i) = True Then
               Debug.Print .List(i)
           End If
       Next i
   End With
End Sub

HTH

Signature

Regards,
Zack Barresse, aka firefytr

>I have 2 Excel VBA questions:
> 1) Is it possible to choose multiple items in a List Box and if so, 2) how
[quoted text clipped - 10 lines]
>
> Christiaan
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.