Hi all,
I'm a complete beginner to VBA, I'm building a big dashboard with repeating tables and charts. All data are located in columns AC:AO in a table of 59 rows, all charts are located in columns E:AA. When building the dashboard I always take last 59 rows and copy below, but the charts source data obviously don't update, so I'm trying to write a macro that would update the source data of a selected chart = shift the source data 59 rows down. It should be simple, I just don't know how to make a relative reference to the current source data in the chart I select. I have 4 different series of data located in different rows of the 59rows table.
This is what I currently have, but it doesn't work
Sub Change_Source()
Dim myDataRow1 As Long, myDataRow2 As Long
myDataRow1 = Range("AD10").Offset(59, 0)
myDataRow2 = Range("AO10").Offset(59, 0)
With ActiveChart
ActiveChart.SeriesCollection (1)
.Values = Range(myDataRow1, myDataRow2)
ActiveChart.SeriesCollection (2)
.Values = Range(myDataRow1, myDataRow2)
ActiveChart.SeriesCollection (3)
.Values = Range(myDataRow1, myDataRow2)
ActiveChart.SeriesCollection (4)
.Values = Range(myDataRow1, myDataRow2)
End With
End Sub
Thanks so much for an advice, it would save me HOURS of time....
hana
Bookmarks