从“超链接”中运行一个宏观。公式,关闭事件不起作用

发布于 2025-02-01 01:44:20 字数 546 浏览 2 评论 0原文

我已经在文件中的几个位置设置了以下表公式:

=HYPERLINK("#restoreDefaultForRange(rngI)","Restore defaults")

#允许我从当前工作簿中运行宏RestoredEfaultForrange()。 在宏内部,我有下面的代码可以加快运行时:

 Application.EnableEvents = False
 Application.ScreenUpdating = False
 Application.Calculation = xlCalculationManual
 Application.DisplayAlerts = False

如果我从vba运行RestoreDefaultForrange(),则everithing可以正常工作,并且事件和计算被关闭。 如果我通过单击超链接来运行相同的宏,则以上代码将被忽略,并且宏的运行速度非常慢,因为事件和计算仍在继续。它是完全相同的宏,并且执行相同的操作。

谁能帮助解释这种行为?我可以纠正它吗?

I've setup in several places in my file the following sheet formulas:

=HYPERLINK("#restoreDefaultForRange(rngI)","Restore defaults")

The # allows me to run the macro restoreDefaultForRange() from the current workbook.
Inside the Macro, I have the code below that allows me to speed up the runtime:

 Application.EnableEvents = False
 Application.ScreenUpdating = False
 Application.Calculation = xlCalculationManual
 Application.DisplayAlerts = False

If I run restoreDefaultForRange() from VBA, everithing works fine, and the events and calculation are turned off.
If I run the same macro by clicking on the Hyperlink, the code above is ignored and the macro runs super slow because Events and calculation remain ON. It's exactly the same macro, and does the same actions.

Can anyone help explain this behaviour? Is there is a way I can correct it?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文