Charts Do Not Automatically Update When Data Changes

后端 未结 9 2840
庸人自扰
庸人自扰 2021-02-19 18:52

Hopefully this is an easy one. I have a series of charts in MS Excel that point to data on the same worksheet. The data on the worksheet is calculated using a VBA function. W

9条回答
  •  眼角桃花
    2021-02-19 19:27

    Just figured out the solution to this issue as I was suffering from the same.

    I've just added "DoEvents()" prior to printing or exporting and the chart got refreshed.

    example

    Sub a()
       Dim w As Worksheet
       Dim a
       Set w = Worksheets(1)
    
       For Each a In w.Range("a1:a5")
         a.Value = a.Value + 1
       Next
    
       DoEvents
    
    End Sub  
    

提交回复
热议问题