R
Richard1284
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 Where:=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 thi
can be done. Can anyone please help?
Much appreciate
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 Where:=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 thi
can be done. Can anyone please help?
Much appreciate