![]() |
ActiveWorkbook.Charts.Delete
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 thi can be done. Can anyone please help? Much appreciate -- Message posted from http://www.ExcelForum.com |
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/ |
All times are GMT +1. The time now is 10:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com