Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I believe you could combine the Workbook_SheetDeactivate and
Workbook_SheetActivate event handlers to accomplish this. Try this code in the ThisWorkbook module of your project. The Deactivate event is triggered before the sheet is deleted and saves the sheet name to a variable. The Activate event is triggered after the sheet is deleted, which tests for the existence of the previous active sheet. Dim strLastSheet As String Private Sub Workbook_SheetActivate(ByVal Sh As Object) Dim wksTemp As Worksheet On Error Resume Next Set wksTemp = Worksheets(strLastSheet) If wksTemp Is Nothing Then MsgBox "Sheet Deleted" End Sub Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) strLastSheet = Sh.Name End Sub "Dev" wrote: Is there a way to see if user selects "Delete Sheet"? I am trying to delete custom doc properties attached to that sheet when user delete a sheet - how do I trigger this event? I don't see any ID number for "Delete Sheet" Thanks for any suggesstion... |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete Chart Event | Charts and Charting in Excel | |||
How to trap delete row event and hide column event? | Excel Programming | |||
Return to Current Sheet in On (sheet activate) event macro | Excel Programming | |||
How do I 'catch' a 'delete cells' event | Excel Discussion (Misc queries) | |||
Assign values to a cell in sheet A, from worksheet_change event of sheet B | Excel Programming |