Hi All,
I have more than 2 charts in my workbook and there is a chart for which I need to change source data range dynamically. I have done all the calculations using VBA code but the only problem is that I am unable to set this calculated range value to the chart property.
Reason for above problem is that it is not necessary that this chart is always active. However, in my google search, I am getting only one type of code which is referencing "ActiveChart", whereas as I mentioned above it is not necessary that this chart is always active. Below is the sample result I am getting online where Rng is a variable.
ActiveChart.SetSourceData Source:=Sheets("Dashboard").Range("W6:X" & Rng)
I also tried to use Chart name to change its source data range but got no success.
Kindly help with the correct line of code to change SourceData Range of a specific chart.
Thanks and regards,
DJ
I have more than 2 charts in my workbook and there is a chart for which I need to change source data range dynamically. I have done all the calculations using VBA code but the only problem is that I am unable to set this calculated range value to the chart property.
Reason for above problem is that it is not necessary that this chart is always active. However, in my google search, I am getting only one type of code which is referencing "ActiveChart", whereas as I mentioned above it is not necessary that this chart is always active. Below is the sample result I am getting online where Rng is a variable.
ActiveChart.SetSourceData Source:=Sheets("Dashboard").Range("W6:X" & Rng)
I also tried to use Chart name to change its source data range but got no success.
Kindly help with the correct line of code to change SourceData Range of a specific chart.
Thanks and regards,
DJ