In Excel, via VBA, is it possible to set chart data from data that is held in memory? For example, if you created an array in VBA [1,2,3,4,5,6...], can you have a chart in the workbook display that?
Thanks - KC
Yes, here's a simple example...
Sub test()
Dim vXVals As Variant
Dim vVals As Variant
vXVals = Array("Wk1", "Wk2", "Wk3")
vVals = Array(100, 175, 150)
With ActiveSheet.ChartObjects.Add(Left:=Range("B2").Left, Top:=Range("B2").Top, Width:=360, Height:=210).Chart
With .SeriesCollection.NewSeries
.Name = "Series Name"
.XValues = vXVals
.Values = vVals
End With
End With
End Sub
Hope this helps!