Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete a chart
Charts.Add myChart = ActiveChart.Name Sheets(myChart).Delete -- Regards, Nigel "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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to delete chart | Charts and Charting in Excel | |||
delete chart | Excel Discussion (Misc queries) | |||
delete worksheet with chart? | Excel Programming | |||
Delete Chart | Charts and Charting in Excel | |||
Using VBA to Delete a Chart | Excel Programming |