Delete a chart

S

Shell

I have created a chart in code as follows:

Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Analysis").Range("B1:C3"),
PlotBy:= _
xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Analysis"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With

How do I delete the chart in code?

Thanks
 
S

Shell

Yes I have. it crashes. I need to rerun it to get the err msg.
Note: the chart is embedded on the same sheet as the data.
 
J

Jon Peltier

You need to delete the chart object. So try something like

ActiveChart.Parent.Delete

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top