Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to delete chart NonTechie Charts and Charting in Excel 7 September 24th 09 05:59 AM
delete chart Wayne Excel Discussion (Misc queries) 6 May 3rd 07 03:00 PM
delete worksheet with chart? Judy Ward Excel Programming 2 August 23rd 05 12:11 AM
Delete Chart agac8103 Charts and Charting in Excel 3 December 13th 04 04:54 AM
Using VBA to Delete a Chart MikeM[_2_] Excel Programming 3 October 14th 03 02:49 AM


All times are GMT +1. The time now is 10:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"