vba 下拉菜单中的 Excel 多选选项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15070630/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 15:02:05  来源:igfitidea点击:

Excel Multi select options in dropdown

excelvbaexcel-vba

提问by Outside the Box Developer

In a spreadsheet, if I want to create a list of items for a dropdown for a user to select, is it possible to do a multi-select with checkboxes?

在电子表格中,如果我想创建一个供用户选择的下拉列表的项目列表,是否可以使用复选框进行多选?

Something like

就像是

_ Item A
_ Item B
_ Item C
...
_ Item Z

and after selection

和选择后

_ Item A
X Item B
...
X Item Z

and in another cell (or cell in other worksheet), have a comma separated list

并在另一个单元格(或其他工作表中的单元格)中,有一个逗号分隔的列表

B,Z (or 2, 26 for the values)

采纳答案by Aviva M.

There are a few ways to do multi-select. You can use an ActiveX list box if configured properly. A form control list box does multi-select but without checkboxes. You can also use regular checkboxes. Here's a good overview of all the available form controls: http://office.microsoft.com/en-us/excel-help/overview-of-forms-form-controls-and-activex-controls-on-a-worksheet-HA010237663.aspx#BMactivex_controls_on_the_control_toolb

有几种方法可以进行多选。如果配置正确,您可以使用 ActiveX 列表框。表单控件列表框可以进行多选,但没有复选框。您还可以使用常规复选框。这是所有可用表单控件的一个很好的概述:http: //office.microsoft.com/en-us/excel-help/overview-of-forms-form-controls-and-activex-controls-on-a-worksheet -HA010237663.aspx#BMactivex_controls_on_the_control_toolb

回答by Red Boy

I had exact same requirement, additionally need to support unselect as well. Hecen, I have posted a working solution of Spread-sheet with Multi drop-down with comma(,) separated values in spread sheet cell. I though of sharing here, as could be helpful to others.

我有完全相同的要求,另外还需要支持取消选择。Hecen,我在电子表格单元格中发布了带有逗号(,)分隔值的多下拉式电子表格的工作解决方案。我想在这里分享,因为可能对其他人有帮助。

  1. Select values from drop-down values appended into cell with comma(,) separation.
  2. Users would be able to do un-select by clicking again to selected value.
  3. If users press delete on cell with values, it will work as un-select-all(reset).
  1. 从附加到单元格的下拉值中选择值,以逗号 (,) 分隔。
  2. 用户可以通过再次单击所选值来取消选择。
  3. 如果用户在带有值的单元格上按下删除,它将作为取消全选(重置)工作。

Here is stack-overflow linkof the question/solution.

这是问题/解决方案的堆栈溢出链接