Excel VBA Re-run formulas (update) when any cell in sheet changes

半城伤御伤魂 提交于 2020-01-05 10:09:37

问题


I've written a Function in VBA to return a certain value based on certain cells' values. I execute/run this function in a formula on a certain cell

=MyFunction()

My problem is, the cells which have the above formula don't automatically update if the cells used in the function (in VBA) are changed.

How can I re-run or update or re-execute the above formula if the certain cells that are used are changed?


回答1:


You must recode your UDF to achieve the desired volatility. Say you want the UDF to re-calculate if A1 or B1 or C1 are changed, then use:

=MyFunction(A1,B1,C1)

Using arguments gets the required volatility.



来源:https://stackoverflow.com/questions/26267023/excel-vba-re-run-formulas-update-when-any-cell-in-sheet-changes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!