Refresh Excel VBA Function Results

后端 未结 9 1059
悲&欢浪女
悲&欢浪女 2020-11-27 06:01

How can I get a user-defined function to re-evaluate itself based on changed data in the spreadsheet?

I tried F9 and Shift

9条回答
  •  猫巷女王i
    2020-11-27 06:20

    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).

提交回复
热议问题