Deleting multiple charts on a single sheet

T

Tyshaua

Hi,
Thanks in advance for the help with some code I've tried to write.
I have people entering data on a sheet. They then click a check box and
excel will take the data and put it into a chart. There are 10 lines of data
avaible to create 10 chart on a designated sheet. My code worked ok until we
were upgrated to v.2007.

It will go though and delete the charts but loop back through (I'm guessing)
and locks up at the ActiveSheet.ChartObjects.Delete

There are two problems I would like to fix.
1. Fix the code so it wont lock up if it does not find a chart to delete.
2. Only Delete charts that are wanting to be redrawn.




Sheets("XSection 1-10").Select


NumSeries = Worksheets("Survey").Range("BV50").Value
For Counter = 1 To NumSeries

ActiveSheet.ChartObjects.Delete

Next Counter
NumSeries = 0

'XSection 9
If Sheets("Survey").Range("BV9") = True Then
Charts.Add
ActiveChart.ChartArea.Select
(this goes on to create the new chart)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top