excel 中vb组合框_Excel数据验证组合框代码

excel 中vb组合框

Instead of selecting a product code in an Excel drop down list, it's usually easier to select a product name instead. However, your pricing calculations might use the product code, instead of the product name, so you need that information.

与其在Excel下拉列表中选择产品代码,通常不如选择一个产品名称。 但是,您的定价计算可能会使用产品代码而不是产品名称,因此您需要该信息。

With a bit of programming in Excel, you can show a description in a combo box, but enter the matching code for the selected item into the cell. You've seen other versions of my data validation combo box code:

通过Excel中的一些编程,您可以在组合框中显示说明,但是将所选项目的匹配代码输入到单元格中。 您已经看到了我的数据验证组合框代码的其他版本:

Keep reading, to see how the new combo box codes example works.

继续阅读,以了解新的组合框代码示例如何工作。

从组合框中选择 (Select From a Combo Box)

I've uploaded a new sample file on the Contextures website, which lets you select a month name, or weekday name, from an Excel combo box.

我已经在Contextures网站上上传了一个新的示例文件,该文件可让您从Excel组合框中选择月份名称或工作日名称。

datavalcomboboxcodes01

When you leave the combo box, the month number, or weekday code is automatically entered in the cell, instead of the full description.

当您离开组合框时,单元格中会自动输入月号或工作日代码,而不是完整的说明。

datavalcomboboxcodes02

命名范围 (The Named Ranges)

In the data validation cells, lists are allowed, and they refer to the named ranges – DayList and MonthList – where the short codes are stored.

在数据验证单元格中,允许使用列表,它们引用存储短代码的命名范围– DayList和MonthList。

datavalcomboboxcodes03

Another range is created for each list, to include the description column, and these names end with "Codes" – DayListCodes and MonthListCodes.

为每个列表创建另一个范围,以包括描述列,并且这些名称以“代码”结尾– DayListCodes和MonthListCodes。

These "Codes" ranges are used to fill the combo box, which is formatted with 2 columns. The first column has a width of zero, so the codes aren't visible.

这些“代码”范围用于填充组合框,该组合框的格式为2列。 第一列的宽度为零,因此看不到代码。

datavalcomboboxcodes04

下载样本文件 (Download the Sample File)

To test the combo box codes example, and see how it works, you can download the sample file from the Contextures website.

若要测试组合框代码示例,并查看其工作方式,可以从Contextures网站下载示例文件。

In the Data Validation section look for DV0057 – Data Validation Combobox Codes.

在“数据验证”部分中查找“ DV0057 –数据验证组合框代码”

The file is in Excel 2007/2010 format, and contains macros. ______________________

该文件为Excel 2007/2010格式,包含宏。 ______________________

翻译自: https://contexturesblog.com/archives/2012/05/03/excel-data-validation-combo-box-codes/

excel 中vb组合框

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值