在For Loop的每次迭代之后,Excel 2013 vba都会刷新图表内容 [英] Excel 2013 vba refresh chart content after each iteration of For Loop
问题描述
问题:for循环的每次迭代后刷新ChartObject中Series的图形表示形式
Problem: Refresh graphical representaion of Series in ChartObject after each iteration of for loop
Ex. y=m*Cos(x)
y - Values
m - parameter
我从带有参数的公式中计算了一些数据.我想想像一下什么影响了XYgraph上参数的变化.我想在for循环中做(添加Sleep
确实有一些时间来查看结果).
数据和公式位于Excel SpreadSheet中.参数的更新脚本在VBA模块中.更新适用于电子表格中的值,但不会影响图形.
I have some data counted from formula with parameter. I want to visualise what influence has the change of parameter on XYgraph. I want to do it in for loop (added Sleep
do have some time to see results).
Data and formula are in Excel SpreadSheet. Update script of parameter is in VBA module. Update works on values in spreadsheet but doesn't affect graph.
WorkBook.RefreshAll
不起作用;
Chart.Refresh
不起作用
WorkBook.RefreshAll
doesn't work;
Chart.Refresh
doesn't work
图表在上一次迭代后更新.
Chart updates after last iteration.
有什么想法吗?
推荐答案
在每个迭代步骤之后,将DoEvents
添加到您的代码中.它对我有用.
Add a DoEvents
to your code after each iteration step. It works for me.
这篇关于在For Loop的每次迭代之后,Excel 2013 vba都会刷新图表内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!