Greetings,
Could someone please tell me why I am getting an error. I used the "Record Macro" to capture a few things and then I added some of my own stuff. The macro fails almost immediately. Why is this?
Also, all the columns in the chart are dynamic ranges.
here is the macro code. it just starts the creation of a graph.
Here are pictures of the error. I have also included the excel file.![]()
Sub Macro() ' ' Test Macro ' ' ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlLine ActiveChart.PlotArea.Select Application.CutCopyMode = False ActiveChart.SeriesCollection(1).Delete ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).Name = "=""Power""" ActiveChart.SeriesCollection(1).Values = "==Fordat.xlsm!Power" ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(2).Name = "=""Amp Hours""" ActiveChart.SeriesCollection(2).Values = "==Fordat.xlsm!Amp_Hours" ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(3).Name = "=""Vbatt""" ActiveChart.SeriesCollection(3).Values = "==Fordat.xlsm!Vbatt" ActiveChart.SeriesCollection(3).XValues = "==Fordat.xlsm!Time" ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(4).Name = "=""Ibatt""" ActiveChart.SeriesCollection(4).Values = "==Fordat.xlsm!Ibatt" End Sub
error.JPGerror2.JPG
Thanks,
Willis
Bookmarks