![]() |
Delete a chart
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 Whe=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 -- Shell |
Delete a chart
Have you tried recording a macro?
-- Don Guillett Microsoft MVP Excel SalesAid Software "Shell" wrote in message ... 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 Whe=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 -- Shell |
Delete a chart
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. -- Shell "Don Guillett" wrote: Have you tried recording a macro? -- Don Guillett Microsoft MVP Excel SalesAid Software "Shell" wrote in message ... 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 Whe=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 -- Shell |
Delete a chart
You need to delete the chart object. So try something like
ActiveChart.Parent.Delete - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Shell" wrote in message ... 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. -- Shell "Don Guillett" wrote: Have you tried recording a macro? -- Don Guillett Microsoft MVP Excel SalesAid Software "Shell" wrote in message ... 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 Whe=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 -- Shell |
All times are GMT +1. The time now is 07:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com