ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   VBA to automatically change source data for existing chart (https://www.excelbanter.com/charts-charting-excel/184614-vba-automatically-change-source-data-existing-chart.html)

ETLahrs

VBA to automatically change source data for existing chart
 
I have a spreadsheet that totals errors for every employee daily and then
sums them by month and year to date. Instead of having 13 charts (1 for each
month and a ytd), I have created a combobox with a list of the months and ytd
and would like to have 1 chart that would change its source data based on the
month that is selected.

The problem I think I am having is setting the range. The numbers are in a
row, but not consective...so January's data is all row 28 but the columns are
D, G, J, M, P, S, V. I am not sure, but because of this I don't know if I
can use:

ActiveChart.SetSourceData Source:=Sheets("Totals").Range("D28", "G28", etc. )

Thank You for any help.


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com