How do I add checkboxes inside a dropdown in Excel or Google Sheets?

0

I would like to have the data validation that is possible with having a dropdown but I would like to have more than one selection.

Is is possible for a cell dropdown to have checkboxes beside the dropdown elements?

Gabriel Fair

Posted 2018-09-15T15:13:13.403

Reputation: 2 070

Answers

1

Instead of Dropdown box, List box is best suitable to add Check boxes for multiple selection.

Let me explain how to do this in Excel (most of Excel commands & methods are applicable to Google Sheet also.)

enter image description here

How it works:

  1. Click Developer Tab, Insert, List Box (from Active X Control).
  2. After you draw the List box right click it.
  3. Then select Properties from the menu.
  4. Find ListFillRange & insert Source data Range (A155:A164).
  5. Find ListStyle box, select 1-fmList StyleOption.
  6. Then select 1–fmMultiSelectMulti from the MultiSelect.
  7. Then select any specified cell (E155), then name it as ListBoxOutput.
  8. Then Click Insert, Shapes and draw an appropriate (C155) shape above the List Box.
  9. Then right click the Shape & select Assign Macro (Rectangle2_Click) from the menu.

Insert the below written code as Module.

Sub Rectangle2_Click()

Dim xSelShp As Shape, xSelLst As Variant, I As Integer

Set xSelShp = ActiveSheet.Shapes(Application.Caller)
Set xLstBox = ActiveSheet.ListBox1

If xLstBox.Visible = False Then
    xLstBox.Visible = True
    xSelShp.TextFrame2.TextRange.Characters.Text = "Click After Pickup Options"
Else
    xLstBox.Visible = False
    xSelShp.TextFrame2.TextRange.Characters.Text = "Click To 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 Sub
  1. Click the Shape to open List box, select items and again click the Shape to put selected items in Cell E155.

Note, adjust cell references for Source item list, List box, Shape's position & for Output cell also.

Rajesh S

Posted 2018-09-15T15:13:13.403

Reputation: 6 800

Gald to help you Gabriel,,, keep asing ☺ – Rajesh S – 2018-09-17T05:36:44.103