刷新所有图表,不闪烁

目标是在重新计算单元格后刷新Excel中的所有图表。

我使用Microsoft Excel 2010。

据我们所知,有一个错误? 在Excel中,以便Excel甚至不会更新图表之后

Application.CalculateFullRebuild 

一个已知的黑客就是做这样的事情:

 Application.ScreenUpdating = False Temp = ActiveCell.ColumnWidth ActiveCell.Columns.AutoFit ActiveCell.ColumnWidth = Temp Application.ScreenUpdating = True 

这确实有用。 但是,所有Excel图表都会闪烁(更新时会变成白色)。 请问,请问有什么办法可以避免这种眨眼?

我试图打电话

 .Refresh 

在所有图表上( https://msdn.microsoft.com/en-us/library/office/ff198180(v=office.14).aspx ):

 For Each ChartObject In ActiveSheet.ChartObjects ChartObject.Refresh Next 

但由于某种原因,我的Excel(2010)显示错误#438“对象不支持此属性或方法”。

你能不能build议,我想念一些重要的东西?

未经testing但是.Refresh可能适用于:

 Sub ChangeCharts() Application.ScreenUpdating = False 'This line disable the on screen update for better performance, the blink you see, you could delete both lanes but it will run slower Dim myChart As ChartObject For Each myChart In ActiveSheet.ChartObjects myChart.Chart.Refresh Next myChart Application.ScreenUpdating = True'This line reenable the on screen update for better performance, the blink you see, you could delete both lanes but it will run slower End Sub 

这是因为(如您所提供的链接所示) .Refresh仅适用于对象图表 ,而不适用于您试图应用它的对象ChartObjects 。 希望它会引导你在正确的方向。 (在代码中还添加了屏幕上闪烁/闪烁的引号)