在Excel 2010的下拉列表中创build一个checkbox

需要在Excel 2010中的下拉列表中创build一个checkbox。已经尝试创build一个列表框,并select了multiselectExtended选项,但这不符合我们的目的。

所附function的示例

样品(http://i.stack.imgur.com/oxoAD.jpg)![样品

解决了!

检查此链接的解决scheme。

您可以在工作表上添加一个活动的表单列表框,并启用多选function。

让我知道你的想法。

我认为唯一的方法是创build一个自定义对话框。 我希望以下内容足够清楚。

  1. 添加对话框:

    在这里输入图像描述

  2. 添加一个列表框:

    在这里输入图像描述

  3. 将数据添加到工作表并在列表框中引用它:

    在这里输入图像描述

  4. 将一个button添加到工作表:

    在这里输入图像描述

  5. 在VBA中添加一个模块并添加以下代码:

    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