How do I create a drop-down list with multiple options?
Many Excel users tend to create drop down list with multiple checkboxes in order to select multiple items from the list per time. Actually, you cant create a list with multiple checkboxes with Data Validation. In this tutorial, we are going to show you two methods to create drop down list with multiple checkboxes in Excel. Use List Box to create a drop down list with multiple checkboxes Use List Box to create a drop down list with multiple checkboxesAs below screenshot shown, in current worksheet, all names in range A2:A11 will be the source data of the list box. Click on the button in cell C4 can output the selected items, and all selected items in the list box will be displayed in cell E4. To achieve this, please do as follows. A. Create a list box with source data1. Click Developer > Insert > List Box (Active X Control). See screenshot: 2. Draw a list box in current worksheet, right click it and then select Properties from the right-clicking menu. 3. In the Properties dialog box, you need to configure as follows.
B: Name the cell which you will locate the selected itemsIf you need to output all selected items into a specified cell such as E4, please do as follows. 1. Select the cell E4, enter ListBoxOutput into the Name Box and press the Enter key. C. Insert a shape to help output the selected items1. Click Insert > Shapes > Rectangle. See screenshot: 2. Draw a rectangle in your worksheet (here I draw the rectangle in cell C4). Then right click the rectangle and select Assign Macro from the right-clicking menu. 3. In the Assign Macro dialog box, click the New button. 4. In the opening Microsoft Visual Basic for Applications window, please replace the original code in the Module window with the below VBA code. VBA code: Create a list with multiple checkboxes Sub Rectangle1_Click() 'Updated by Extendoffice 20200730 Dim xSelShp As Shape, xSelLst As Variant, I, J As Integer Dim xV As String Set xSelShp = ActiveSheet.Shapes(Application.Caller) Set xLstBox = ActiveSheet.ListBox1 If xLstBox.Visible = False Then xLstBox.Visible = True xSelShp.TextFrame2.TextRange.Characters.Text = "Pickup Options" xStr = "" xStr = Range("ListBoxOutput").Value If xStr <> "" Then xArr = Split(xStr, ";") For I = xLstBox.ListCount - 1 To 0 Step -1 xV = xLstBox.List(I) For J = 0 To UBound(xArr) If xArr(J) = xV Then xLstBox.Selected(I) = True Exit For End If Next Next I End If Else xLstBox.Visible = False xSelShp.TextFrame2.TextRange.Characters.Text = "Select Options" For I = xLstBox.ListCount - 1 To 0 Step -1 If xLstBox.Selected(I) = True Then xSelLst = xLstBox.List(I) & ";" & xSelLst End If Next I If xSelLst <> "" Then Range("ListBoxOutput") = Mid(xSelLst, 1, Len(xSelLst) - 1) Else Range("ListBoxOutput") = "" End If End If End SubNote: In the code, Rectangle1is the shape name; ListBox1 is the name of the list box; Select Options and Pickup Options are the displayed texts of the shape; and the ListBoxOutput is the range name of the output cell. You can change them based on your needs. 5. Press Alt + Q keys simultaneously to close the Microsoft Visual Basic for Applications window. 6. Click on the rectangle button will fold or expand the list box. When the list box is expanding, checking the items in the list box, and then click the rectangle again to output all selected items into cell E4. See below demo: 7. And then save the workbook as an Excel MacroEnable Workbookfor reusing the code in the future. Create drop down list with checkboxes with an amazing toolBesides the above demo, we also provide a step-by-step guide to demonstrate how to apply this feature to achieve this task. Please do as follows. 1. Open the worksheet that you have set data validation drop-down list, click Kutools > Drop-down List > Drop-down List with Check Boxes > Settings. See screenshot: 2. In the Drop-down List wit Check Boxes Settings dialog box, please configure as follows.
3. The last step, click Kutools > Drop-down List > Drop-down List with Check Boxes > Enable Drop-down List of Check Boxes to activate this feature. From now on, when you click the cells with drop-down list in a specified scope, a list box will pop up, please select items by checking the checkboxes to output into cell as the below demo shown (Take the Modify mode as an example). For more details of this feature, please visit here. If you want to have a free trial ( 30-day) of this utility, please click to download it, and then go to apply the operation according above steps. Related articles:Autocomplete when typing in Excel drop down list Create drop down list from another workbook in Excel Create a searchable drop down list in Excel Auto populate other cells when selecting values in Excel drop down list More tutorials for drop down list... The Best Office Productivity ToolsKutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
|