Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Capture "after delete" Worksheet

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Capture "after delete" Worksheet

Many thanks Bob,

It help.

"Bob Phillips" wrote in message
...
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










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
Is there a formula to capture data between "Tabs" on a spreadsheet Dan the Man[_2_] Excel Worksheet Functions 17 July 6th 07 08:51 PM
VBA to disable "Delete...." on shortcut menu of worksheet tab? Mary Kathryn Excel Discussion (Misc queries) 3 March 3rd 06 05:54 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM
Make "Worksheet Menu Bar" invisible or Delete/hide it's buttons Bob Phillips[_5_] Excel Programming 0 August 11th 03 01:05 PM


All times are GMT +1. The time now is 04:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"