I have a presentation template with very specific styling rules/guidelines. One of those rules is that the number of bars in a chart can change dynamically.
The template currently sets a static data range of “Sheet1!$A$1:$B$7”, meaning I can’t have more than 6 bars (1 series title, 6 data points).
I am currently trying to adjust the data range of the table with: chart.ChartData.SetRange($“Sheet1!$A$1:$B${LastRow}”) and the number of rows adjusts to fit the new range, but all formatting of the chart is also reset to the default formatting and all of my template style is lost.
I am looking for a way to avoid losing the template formatting or for an easy way to copy over the styles from the template to the new range for Bar/Pie/Graph/etc. charts. I have at least one of each chart type in this project, so the solution needs to be universal.
If more info is needed, please contact me.