Creating "dead" chart with VBA
Posted by Denis Kertz on March 21, 2001 3:25 PM
I'm trying to create a "dead" chart with Excel VBA where the chart's data is actual values and not linked to the spreadsheet where the data values were stored. Supposedly this should work (Excel 97 SR-2):
ValArr = Range(...) # vals like 97.123456789
WkArr = Range(...) # dates like 3/21/2001
With ActiveChart.SeriesCollection.NewSeries
.XValues = WkArr
.Values = ValArr
End With
I get an "Unable to set XValues property of Series Class" error. I found a .Values assignment workaround when I truncated the many decimal places to only 4 (97.1234) but my .XValues assignment fails when I use more than about 12 dates (my example has 23 values/dates). I have tried converting the dates explicitly to dates (CDate) and strings (CStr) but nothing works. I believe this is a bug and am looking for a workaround. Any help or suggestions?