ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto Deleting of a Sheet? (https://www.excelbanter.com/excel-programming/369105-auto-deleting-sheet.html)

Ben H

Auto Deleting of a Sheet?
 
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.

Tom Ogilvy

Auto Deleting of a Sheet?
 
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.
--
Regards,
Tom Ogilvy


"Ben H" wrote:

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.



All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com