Clear Chart Contents

  • Thread starter Thread starter Paul Corrado
  • Start date Start date
P

Paul Corrado

I am developing an application where a userform displays a gif of a chart.
It took some time, but I've got that part working just fine.

I now need to be able to clear the chart contents when the userform is
closed so it is ready for the next run.

The difficulty I am having is that I have used a blank Chart (no data range
reference) to house a picture of the screen (select worksheet range,
shift+edit select copy picture) so that picture can be exported as a GIF so
that image can be imported into the userform picture frame.

I would appreciate any assistance in helping resolve this issue.

So you know

I have tried a variety of forms using ActiveChart, ChartArea, ClearContents
and that doesn't work. Oddly, it is fairly easy to figure out how to get
the picture in the chart. Now I just want to be able to get it out!

TIA

PC
 
Not sure why this wouldn't work when I tried it (like a million times)
earlier. However, an issue that remains is that this code requires a
"counter" (the reference to K1) to keep track of the advancing picture
number. While that is simple enough to create, I have some concerns about
the reliability of that method. Any input would be greatly appreciated.

TIA

PC

PicName = "Picture " & Worksheets("Sheet1").Range("K1")
MsgBox PicName


ActiveWindow.Visible = False
Windows("Book1").Activate
Range("C13").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.Shapes(PicName).Select
Selection.Delete
 

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

Back
Top