View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Capture "after delete" Worksheet

Hi Rony,

Here is a way.

First add this code to a standard code module

Public shName As String

Sub Deletesheet()
Dim oWS As Object
On Error Resume Next
Set oWS = Sheets(shName)
If oWS Is Nothing Then
MsgBox shName & " has been deleted"
End If
End Sub

and then add this to the ThisWorkbook code module

Private Sub Workbook_SheetDeactivate(ByVal sh As Object)
shName = sh.Name
Application.OnTime Now + TimeSerial(0, 0, 1), "DeleteSheet"
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Rony Boter" wrote in message
...
Hello,



I'm trying to capture the event after the Excel user deletes specific
worksheet.

Can it be done?





Any help would be appreciated


--
Best Regars
Rony Boter