vba 新行时自动插入 dropDownList
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14252945/
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
Auto insert a dropDownList when a new row
提问by user1292656
I have an excel sheet with three columns. (Name), (Surname) and (Identity Type). The colum identity type can take only 3 values, (Id,Passport,Drivers Licence). What i want is when the user Start writing on new row then a dropdownlist with those 3 values on the column Identity Type should be appeared. Is that possible?. Thanks in advance
我有一个包含三列的 Excel 表。(姓名)、(姓氏)和(身份类型)。列身份类型只能采用 3 个值,(Id、Passport、Drivers Licence)。我想要的是当用户开始在新行上书写时,应该出现一个下拉列表,其中包含 Identity Type 列上的这 3 个值。那可能吗?。提前致谢
回答by whytheq
Not really any need for VBA use Data Validation:
真的不需要 VBA 使用数据验证:
Highlight all the cells in the column which you'd like to add this drop-down into.
突出显示要将此下拉列表添加到的列中的所有单元格。
The in the Data
menu you need to choose Data Validation
. You should then get the following and you need to select the three values which you want in the drop-down:
在Data
您需要选择的菜单中Data Validation
。然后您应该得到以下内容,您需要在下拉列表中选择您想要的三个值:
This results in:
这导致:
Or am I misunderstanding your question ?
还是我误解了你的问题?
回答by user10821923
I know this is old, but instead of selecting a cell for the validation, select the entire column. This will add the validation to all cells in the column and will give you the drop down on all rows as your data expands.
我知道这是旧的,但不是选择一个单元格进行验证,而是选择整列。这会将验证添加到列中的所有单元格,并在数据扩展时为您提供所有行的下拉列表。