Excel,使用名称字段指定特定单元格

发布于 2024-09-08 10:03:43 字数 250 浏览 0 评论 0原文

我创建了一个宏,不允许在 Excel 工作表的 B 列和 C 列中同时存在值。我想通过允许名称为 DayShift 或 AfterShift 的单元格来对该公式进行例外处理。

我创建了这个:

If ActiveCell.Name = "DayShift" Or ActiveCell.Name = "AfterShift" Then

但它似乎不起作用,只会使其他单元格出错。有谁知道如何正确执行此操作?

I created a macro that doesn't allow values in both the B and C columns of an Excel sheet. I want to make an exception to that formula by allowing cells with the names DayShift or AfterShift.

I created this:

If ActiveCell.Name = "DayShift" Or ActiveCell.Name = "AfterShift" Then

But it doesn't seem to work and just makes other cells error. Does anyone know how to do this correctly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寂寞笑我太脆弱 2024-09-15 10:03:43

试试这个:

If ActiveCell.Name.Name = "DayShift" Or ActiveCell.Name.Name = "AfterShift" Then

Try this:

If ActiveCell.Name.Name = "DayShift" Or ActiveCell.Name.Name = "AfterShift" Then
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文