View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Koppel Greg Koppel is offline
external usenet poster
 
Posts: 79
Default ActiveWorkbook.Charts.Delete

Try Activeorkbook.Charts(0).Delete

HTH, Greg

"Richard1284 " wrote in message
...
Hi everyone,

I am having a problem deleting a chart that I have placed on my 'Main'
worksheet. Upon using the.....

ActiveWorkbook.Charts.Delete

....nothing happens because it doesn't detect my graph.

Here's what happens in my app.

I create the graph.....
---------------------------------------------------------------------
Sub CreatChart()

Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Main").Range
("A199:E201"), PlotBy _
:=xlRows
ActiveChart.Location Whe=xlLocationAsObject, Name:="Main"

End Sub'
---------------------------------------------------------------------


Then I move it to a better location

---------------------------------------------------------------------
Sub CoverRangeWithAChart()
'subroutine used to fill graph of the range I chose
Dim RngToCover As Range
Dim ChtOb As ChartObject
Set RngToCover = ActiveSheet.Range("C13:L29")
Set ChtOb = ActiveChart.Parent
ChtOb.Height = RngToCover.Height ' resize
ChtOb.Width = RngToCover.Width ' resize
ChtOb.Top = RngToCover.Top ' reposition
ChtOb.Left = RngToCover.Left ' reposition
ActiveChart.PlotArea.Interior.ColorIndex = 42
End Sub
--------------------------------------------------------------------

Now all that is left it to delete it however I am stuck on how to this
can be done. Can anyone please help?

Much appreciated


---
Message posted from http://www.ExcelForum.com/