I'm trying to select a graph on a worksheet which already exists and edit the data range by assigning it based on values in another sheet where it knows to keep looking for data until it runs out of columns.
I can't get it work with it not recognising the object correctly and other online help hasn't worked.
Sub GraphData()
Dim chrt As Chart
Sheets("ICB Time Series").ChartObjects("Chart1a").Select
Set chrt = ActiveChart
With Sheets("Charts Data")
chrt.SetSourceData Source:=.Range("B22:B23").End(xlToRight).Column
End With
End Sub
.Columnreturns the column index, not a range.