刷新 Excel VBA 函数结果 [英] Refresh Excel VBA Function Results
本文介绍了刷新 Excel VBA 函数结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让用户定义的函数根据电子表格中已更改的数据重新评估自身?
How can I get a user-defined function to re-evaluate itself based on changed data in the spreadsheet?
我尝试了 F9 和 Shift+F9.
I tried F9 and Shift+F9.
似乎唯一可行的方法是使用函数调用编辑单元格,然后按 Enter.
The only thing that seems to work is editing the cell with the function call and then pressing Enter.
推荐答案
你应该在你的函数顶部使用Application.Volatile
:
You should use Application.Volatile
in the top of your function:
Function doubleMe(d)
Application.Volatile
doubleMe = d * 2
End Function
它会在工作簿更改时重新评估(如果您的计算设置为自动).
It will then reevaluate whenever the workbook changes (if your calculation is set to automatic).
这篇关于刷新 Excel VBA 函数结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文