98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Combo box selections
Combo box selections
Resolved · Low Priority · Version 2003
Louise has attended:
Excel VBA Intro Intermediate course
Combo box selections
How do you create a code for selecting multiple values in a drop down box - for example when you hold down ctrl and the make your selection
RE: Combo box selections
Hi Louise,
Thank you for your question.
As far as I am concerned, you cannot select multiple options from a combo box. However if you create a listbox you can change the MultiSelect property to 1-frmMultiSelectMulti.
Use the code we created to populate the values in the listbox based on the report type chosen.
This will then allow you to use the Ctrl and Click technique to select more than one value.
I hope this answers your question.
Regards
Simon
RE: Combo box selections
Hi Louise,
Please find below some code that displays a message box with the multiple values you select from the list box.
Private Sub CommandButton1_Click()
strMsg = "You chose the following entries form the list box:" & vbCrLf
For i = 1 To lbentries.ListCount
' works out how many values in list
If lbentries.Selected(i - 1) = True Then
' if the first value is selected then...
strMsg = strMsg & lbentries.List(i - 1) & vbCrLf
'msgbox will show the message and the entry
End If
Next i
'this is the loop and it moves and checks for the second entry to have been selected and keeps looping until you click the command button.
MsgBox strMsg
'the result will be a message box that will display the message and the multiple values selected.
I hope this helps.
Regards
Simon
Wed 24 Jun 2009: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Shortcuts for working with named ranges in ExcelIf you are working with or creating named ranges in your spreadsheets, then you may find the following shortcut keys useful. |