FREE Excel STUFF
SearchSearch Excel Content
Excel Help. Popular
NEW! Multiple Excel Search & Links
Excel Formulas
Excel Macros
Excel Newsletter
PRODUCTS
Up to $139.00 FREE!
Categories & SearchSearch for software
Excel Templates
Excel Add-ins
Excel Training
More....
OTHER
Excel Development


Multi Select ListBox


NEW! More Books..
Add to Google advanced search! Free Help!

Add Excel Answers & Search To Your Google Toolbar Details

Excel VBA: MutliSelect Property is -1 fmMultiSelectMulti

Current Special! Complete Excel Excel Training Course for Excel 97 - Excel 2003, only $145.00. $59.95 Instant Buy/Download, 30 Day Money Back Guarantee & Free Excel Help for LIFE!

Back to: Excel VBA . Got any Excel/VBA Questions? Free Excel Help

Multi Select ListBox Download Multi Select ListBox Example

When using a ListBox we can do so in a way that can allow users to make multiple selections from the ListBox. After they have made their selection(s) normally a CommandButton would be used to take those selections and place them onto a Worksheet or another UserForm Control.

Single Selection ListBox

As mentioned above, we can have our user select one, or more items in a ListBox. The procedure below take a single selected ListBox item and places it into a range at the bottom of a list.

Sheet2.Range("A65536").End(xlUp)(2, 1) = ListBox1.Value

For such code to work the ListBox must have its MultiSelect Property set to 1 fmMultiSelectSingle

MutliSelect Property is -1 fmMultiSelectMulti

When have set the MultiSelect Property set to -1 fmMultiSelectMulti we can allow users to make multiple selections. However, due to MultiSelect Property set to -1 fmMultiSelectMulti we can no longer use simple code like above to return the selected items to our cells. To do this with multiple selections we can use code like shown below;

Private Sub CommandButton2_Click()
Dim lItem As Long
    For lItem = 0 To ListBox1.ListCount - 1
        If ListBox1.Selected(lItem) = True Then
            Sheet2.Range("A65536").End(xlUp)(2, 1) = ListBox1.List(lItem)
            ListBox1.Selected(lItem) = False
        End If
    Next
End Sub

Download Multi Select ListBox Example

Excel Dashboard Reports & Excel Dashboard Charts 50% Off

Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to special@ozgrid.com 31 days after purchase date.


Instant Download and Money Back Guarantee on Most Software

Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!

Add to Google Search Tips FREE Excel Help

Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft