vb组合框回车添加项目
There are a few versions of the data validation combo box technique on my website. The files use programming to make a combo box appear when you click, or double-click, on a cell that has a drop down list. The latest version shows how to add new items to data validation combo box lists.
我的网站上有几种版本的数据验证组合框技术。 在具有下拉列表的单元格上单击或双击时,文件将使用编程方式使组合框出现。 最新版本显示了如何向数据验证组合框列表中添加新项目。
组合框的好处 (Combo Box Benefits)
The advantage to using a combo box is that you can show the text in a larger font, and it autocompletes as you type, unlike a cell with a drop down list.
使用组合框的优势在于,您可以使用较大的字体显示文本,并且键入时它会自动完成,这与带有下拉列表的单元格不同。
![datavalcombosheet14 datavalcombosheet14](https://i-blog.csdnimg.cn/blog_migrate/b43fd9cb82372d6098d736241a3b364d.png)
将新项目添加到下拉列表 (Add New Item to Drop Down List)
Another one of my sample files let you add new items to a drop down list, on the fly. If you type a new item, a message box asks if you want to add it. Then, if you click Yes, it’s put into the list, in alphabetical order.
我的另一个示例文件可让您随时将新项目添加到下拉列表中。 如果键入新项目,则会出现一个消息框,询问您是否要添加它。 然后,如果您单击“是”,则会按字母顺序将其放入列表。
![datavaladdsorttable01 datavaladdsorttable01](https://i-blog.csdnimg.cn/blog_migrate/3aeff6aad5f0cb95783033421a1b155e.png)
将新项目添加到组合框 (Add New Items to Combo Box)
Someone recently asked if it was possible to combine those techniques, so I’ve created a new sample file that does just that! When you click on a cell that has a data validation list, a combo box appears. If you type an item that isn’t in the list, you’re prompted to add it.
最近有人问是否可以结合使用这些技术,所以我创建了一个新的示例文件来实现这一目的! 当您单击具有数据验证列表的单元格时,将出现一个组合框。 如果您键入不在列表中的项目,则会提示您添加它。
NOTE: The Add New Item code is triggered when you press Tab or Enter to get out of the Combo box.
注意:当您按Tab或Enter退出组合框时,将触发“添加新项”代码。
To see the file, and how it works, you can download it from my Contextures website. On the Excel Samples page, look for DV0062 - Data Validation Click Combobox - Add New Items.
若要查看文件及其工作方式,可以从我的Contextures网站下载它。 在“ Excel样本”页面上,查找DV0062-数据验证单击组合框-添加新项目 。
The file is in xls format, and contains macros. ___________________
该文件为xls格式,并包含宏。 ___________________
翻译自: https://contexturesblog.com/archives/2013/12/19/add-new-items-to-data-validation-combo-box/
vb组合框回车添加项目