Auto Deleting of a Sheet?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all.

I have a macro that creates a sheet of data then using that new sheet,
creates a chart. The data sheet is then hidden for easy of use for the end
users.

The problem I have is that when the user deletes the chart, the data sheet
remains. Is there a way to link the data sheet with the chart so that when
the chart is removed, the corrosponding data sheet is also removed?

Thanks - Ben H.
 
There is no delete sheet event per se. However, you might be able to use the
workbook level sheetdeactivate event. the sh argument is a reference to the
chart (assumes the chart is a chart sheet and not an embedded object on a
worksheet) or sheet that has been deactivated. It fires if you delete a
chart - but unfortunately at the time the event fires, the chart still
exists. You could do an Application.Ontime Now type command that fires a
macro to check to see if it has been deleted and then delete the chart.
Calling the ontime immediately would still allow the chart "time" to be
deleted.
 
Back
Top