Reading data for chart
January 7th, 2009 by rose
I have a problem regarding how to write a VBA code to read data for making a chart.
I did following :
Sub UpdateChart(item)
Dim TheChart As Chart
Dim DataSheet As Worksheet
Dim chart_data(1268) As Double
.............................
Set TheChart = Sheets("plot")
Set DataSheet = Sheets("Analytics")
.................................
For i = 2 To 1269
chart_data(i - 1) = DataSheet.Range("E30:E1298")(i).Value
Next i
With TheChart
.SetSourceData DataSheet.Range("E31:E1298")
.ChartType = xlLine
.Deselect
End With
........................
It is working fine. But if I put ".SetSourceData = "chart_data"" I am getting error as : Argument not optional (Error 449). Can anyone tell me wjhat will be the correct approach?
Rgds,
#If you have any other info about this subject , Please add it free.# |
Posted in ncgloryholes.com | edit