我正在更改旧的 Excel 电子表格,并且收到用户请求,将下拉列表添加到日期选择字段。
已使用“<=TODAY()”子句为相关单元打开数据验证(该工作表包含有关生产效率的信息,由于不存在数据,因此不知道下一步)。
用户请求过去 7 天的下拉列表。我可以创建一个列表并在 VBA 中枚举它,但我很难想出一种在不使用验证的情况下将下拉列表应用于单元格的方法。
这可能吗?
I'm changing an old Excel spreadsheet and have got a user-request to add a drop-down list to a date selection field.
Data Validation is already turned on for the cell in question with a "<=TODAY()" clause (the sheet contains information on production efficiency, no idea going forward since data is not there).
The user requests a drop-down listing the past seven days. I can make a list and enumerate it in VBA, but I am having difficulties coming up with a way to apply a drop-down list to a cell without using Validation.
Is this possible?
发布评论
评论(2)
您可以尝试以下一些方法:
一个。请参阅 MSDN
上的一些标准方法
b.或者使用此博客上的插件
OnChange
来检查输入的值是否在今天之前。Here are some ways you can try:
a. See some standard way on MSDN
b. or with an addin on this blog
OnChange
to check if the value entered is before today.为什么不使用列表规则替换现有的数据验证规则?只需创建一个新工作表并输入 A1:A7
然后将数据验证规则设置为“列表”并将新工作表上的源设置为 A1:A7。然后将纸张隐藏起来,以免妨碍操作。这应该保留旧的验证要求。
Why not replace the existing data validation rule with a list rule? Just create a new sheet and enter in A1:A7
Then set your data validation rule to "List" and set the Source to A1:A7 on the new sheet. Then hide the sheet just to keep it out of the way. This should preserve the old validation requirement.