I
inquirer
Could someone tell me what I am doing wrong please in this code:
'Dim myChart As Chart
wsheet = ActiveSheet.Name
Charts.Add
cname = ActiveChart.Name
'Set myChart = ActiveChart
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets("aulogbd").Range("C2:C23,E2:E23"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=aulogbd!R2C3:R23C3"
ActiveChart.SeriesCollection(1).Name = "=""0,0"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="aulogbd"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
more code
'myChart.Activate
Worksheets(wsheet).ChartObjects(cname).Activate
When I run this I get an error Unable to get the ChartObjects of the
worksheet class at the last line. If I use the myChart logic (Remmed out
here) instead of cname = ActiveChart.Name and
Worksheets(wsheet).ChartObjects(cname).Activate , I get an Automation error.
What I want to do is to create a chart and then go back to that chart at a
later point and add more data to it.
Thanks
Chris
'Dim myChart As Chart
wsheet = ActiveSheet.Name
Charts.Add
cname = ActiveChart.Name
'Set myChart = ActiveChart
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets("aulogbd").Range("C2:C23,E2:E23"), _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).Delete
ActiveChart.SeriesCollection(1).XValues = "=aulogbd!R2C3:R23C3"
ActiveChart.SeriesCollection(1).Name = "=""0,0"""
ActiveChart.Location Where:=xlLocationAsObject, Name:="aulogbd"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
more code
'myChart.Activate
Worksheets(wsheet).ChartObjects(cname).Activate
When I run this I get an error Unable to get the ChartObjects of the
worksheet class at the last line. If I use the myChart logic (Remmed out
here) instead of cname = ActiveChart.Name and
Worksheets(wsheet).ChartObjects(cname).Activate , I get an Automation error.
What I want to do is to create a chart and then go back to that chart at a
later point and add more data to it.
Thanks
Chris