使Excel从VBA中刷新工作表上的数据 [英] Getting Excel to refresh data on sheet from within VBA
本文介绍了使Excel从VBA中刷新工作表上的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Excel中获取电子表格数据以从VBA中重新计算自身,而不必仅仅更改单元格值?
How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?
推荐答案
以下几行将达到目的:
ActiveSheet.EnableCalculation = False
ActiveSheet.EnableCalculation = True
编辑:.Calculate()
方法不适用于所有功能.我在带有附加数组功能的工作表上对其进行了测试.我正在使用的生产表非常复杂,以至于我不想测试.CalculateFull()
方法,但是它可能会起作用.
The .Calculate()
method will not work for all functions. I tested it on a sheet with add-in array functions. The production sheet I'm using is complex enough that I don't want to test the .CalculateFull()
method, but it may work.
这篇关于使Excel从VBA中刷新工作表上的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文