c#中让下拉列表隐藏_隐藏下拉列表中的二手物品

c#中让下拉列表隐藏

Don’t let Excel yell at us, if we accidentally enter a duplicate value in a column. Okay, maybe Excel isn’t really yelling, but it seems like that when a data validation error message pops onto the screen. Instead of letting people pick a duplicate, use this trick to hide used items in a worksheet drop down list. You can’t pick an item if it isn’t there!

如果我们不小心在列中输入重复的值,请不要对Excel吼叫。 好的,也许Excel并不是真的在大喊大叫,但是当数据验证错误消息弹出到屏幕上时,好像是这样。 使用此技巧可以隐藏工作表下拉列表中的已用项目,而不是让人们选择重复项。 如果没有物品,您将无法选择!

隐藏二手物品 (Hide Used Items)

With data validation, it’s easy to make a drop down list of names, or weekdays, or products, or whatever else you need. Then, instead of typing, just pick from the list.

通过数据验证,可以轻松地创建名称,工作日,产品或其他所需内容的下拉列表。 然后,无需输入,只需从列表中选择即可。

允许多次使用 (Allow Multiple Uses)

Sometimes duplicates are okay – if you sell Pens, it’s okay to add that product to any row where it was sold.

有时可以复制-如果您出售Pens,则可以将该产品添加到销售的任何行中。

一次使用物品 (Use Items Once)

But sometimes you only want an item used once. For example, if you’re coaching a baseball team, each player is assigned to one position at the start of the inning.

但是有时您只希望使用一次。 例如,如果您在指导棒球队,则在局开始时将每个球员分配到一个位置。

In the drop down list shown below, Mike was assigned as the pitcher, so his name doesn’t show up in the list now. Somebody else will have to be the catcher.

在下面显示的下拉列表中,Mike被分配为投手,因此他的名字现在没有出现在列表中。 其他人将必须成为捕手。

Or, if you’re creating a work schedule, employees should only be scheduled once per day.

或者,如果您正在创建工作时间表,则每天应该只安排一次员工。

In the next drop down list, Fred and Joe have been assigned, so their names aren’t in the list now.

在下一个下拉列表中,已分配了Fred和Joe,因此他们的名字现在不在列表中。

公式删除使用过的物品 (Formulas Remove Used Items)

To hide the used items, some fancy formulas are used on another worksheet.

为了隐藏使用过的项目,在另一个工作表上使用了一些精美的公式。

In column B, names that have a number have not been used.

在B列中,未使用带有数字的名称。

Then, in column C, an array formula sorts the names by those numbers, so that moves blank cells to the end of the list.

然后,在C列中,一个数组公式按这些数字对名称进行排序,以便将空白单元格移到列表的末尾。

The names in column C are used for the drop down list.

C列中的名称用于下拉列表。

相关下拉列表 (Dependent Drop Downs)

You can use this technique with dependent drop down lists too. In the example shown below, choose a type in column A.

您也可以对依赖的下拉列表使用此技术。 在下面显示的示例中,在A列中选择一种类型。

Then, choose a related item in column B, but if an item has been used, like SI-02, it is removed from the drop down list.

然后,在B列中选择一个相关的项目,但是如果使用了某个项目(例如SI-02),则会将其从下拉列表中删除。

获取工作簿 (Get the Workbook)

You can get the detailed instructions, and sample workbook, on the Hide Used Items page on my Contextures website.

您可以在我的Contextures网站上的“ 隐藏使用的项目”页面上获得详细的说明和示例工作簿。

There are four example files to download, and no macros in the workbooks.

有四个示例文件可供下载,而工作簿中没有宏。

翻译自: https://contexturesblog.com/archives/2016/11/03/hide-used-items-in-drop-down-list/

c#中让下拉列表隐藏

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值