Charts Do Not Automatically Update When Data Changes

后端 未结 9 2822
庸人自扰
庸人自扰 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:39

    For 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
    
       w.ChartObjects(1).Chart.Refresh
    
    End Sub  
    

    alt text

提交回复
热议问题