使用 Excel 中的公式填充空白单元格(无需 VBA)

发布于 2024-09-16 07:01:47 字数 197 浏览 1 评论 0原文

例如

(注意以下所有操作都引用同一单元格)

  1. 单元格包含一个公式 填充该值的“默认”值 细胞。
  2. 用户覆盖默认值。
  3. 用户决定删除该值 他们已经进入了。
  4. 自动恢复原来的公式 提供“默认”值 再次。

没有 VBA 是否可以实现这一点,或者是否有合理的解决方法?

e.g.

(N.B. All the following actions reference the same cell)

  1. A cell contains a formula to
    populate the 'default' value of that
    cell.
  2. The user overwrites the default value.
  3. The user decides to delete the value
    that they have entered.
  4. The original formula is automatically reinstated
    to provide the 'default' value
    again.

Is this possible without VBA, or is there a reasonable work around?

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

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

发布评论

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

评论(2

全部不再 2024-09-23 07:01:48

据我所知这是不可能的。

显然,当您写入一个值时,您将覆盖预先存在的公式。因此,您需要将公式存储在其他位置才能恢复它。但由于Excel中的循环引用检测是“静态的”,因此禁止公式写入另一个单元格。例如,您可以查看 UDF 功能,其中明确说明了这一点。

我知道在 Excel 环境中存储(和执行)某些内容的唯一其他地方是 VBA 代码......

AFAIK this is not possible.

Obviously, when you write a value you are overwriting the pre-existent formula. So you need to store the formula somewhere else to be able to restore it. But as the circular reference detection in Excel is "static", it is forbidden for a formula to write to another cell. You can look for example at the UDF feature, where this is clearly stated out.

The only other place I know to store (and execute) something within the Excel environment is VBA code ...

懷念過去 2024-09-23 07:01:47

我不确定您打算如何在没有 VBA 的情况下完成所有这些工作。我不是 Excel 向导,但我认为没有 VBA 就无法完成。您的程序中需要一些智能,而这些智能(我相信)无法通过简单的功能来执行。

I'm not sure how you plan to do all of that without VBA. I'm not and Excel wizard, but I don't think it can done without VBA. There is some intelligence needed in your procedures that can not (I believe) be performed with simple functions.

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