刷新Excel VBA功能结果 [英] Refresh Excel VBA Function Results

查看:126
本文介绍了刷新Excel VBA功能结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何获得用户定义的函数来重新评估自己(根据电子表格中更改的数据)?我试过 F9 Shift + F9 工作。唯一似乎工作的是使用函数调用编辑单元格,然后按Enter键。有任何想法吗?我似乎记得能够做到这一点...

解决方案

你应该使用 Application.Volatile 在你的函数的顶部:

 函数doubleMe(d)
Application.Volatile
doubleMe = d * 2
结束函数

每当工作簿将重新评估更改(如果您的计算设置为自动)。


Does anyone know how I can get a user-defined function to re-evaluate itself (based on changed data in the spreadsheet)? I've tried F9 and Shift+F9, but those don't work. The only thing that seems to work is editing the cell with the function call and then pressing Enter. Any ideas? I seem to remember being able to do this...

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆