prem shekhar
prem shekhar

Reputation: 239

create a checkbox inside a dropdown in excel 2010

Need to create a checkbox inside a dropdown in excel 2010. Have already tried creating a list box and selected the multiselectExtended option but that is not serving our purpose.

Sample of the required functionality attached:

sample](https://i.sstatic.net/oxoAD.jpg)![sample

Upvotes: 3

Views: 28997

Answers (2)

MS Sankararaman
MS Sankararaman

Reputation: 362

Solved!

Check this link for the solution.

You can add an active form list box on the sheet and have the multi-select enabled.

Let me know your thoughts.

Upvotes: 6

glh
glh

Reputation: 4972

I think the only way to do this is to create a custom dialog. I hope the following is clear enough to do so.

  1. Add the dialog:

    enter image description here

  2. Add a list box:

    enter image description here

  3. Add the data to a sheet and reference it in the List Box:

    enter image description here

  4. Add a button to the sheet:

    enter image description here

  5. Add a module in VBA and add the following code:

    Public diag As Object 'the dialog box
    
    'this code is assigned to the button on the sheet
    Sub Button3_Click()
        Set diag = DialogSheets("Dialog1") 'define the dialog box
        diag.Show 'sow the dialog box
    End Sub
    
    'to be assigned to the "OK" button in the dialog
    Sub Button2_Click()
    
        ' finds selected items
        Dim Msg As String, i As Integer
        Msg = ""
        With diag.ListBoxes("List Box 5")
            For i = 1 To .ListCount
                If .Selected(i) Then
                    Msg = Msg & .List(i) & ";"
                End If
            Next i
        End With
    
        'set the cell the values as needed
        Worksheets("Sheet1").Range("A1") = Msg
    End Sub
    

Upvotes: 3

Related Questions