LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Detecting When User Deletes a Sheet

No, there is not any specific event, BUT you can achieve that with a little
effort:
* In ThisWorkbook declare a module variable to hold the last deactivated sheet
* do little programming in SheetDeactivate and SheetActivate events to
verify the last deactivated sheet is still alive:

code sample in ThisWorkbook:

Private mOldSheetName As String

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim oldFound As Boolean
Dim ws As Worksheet
oldFound = False
For Each ws In Worksheets
If ws.Name = mOldSheetName Then
oldFound = True
Exit For
End If
Next
If Not oldFound Then
Debug.Print "Sheet deleted: " & mOldSheetName
End If
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
mOldSheetName = Sh.Name
End Sub



" wrote:

Is any event raised when a sheet gets deleted? I'd like to remove a
control button upon certain sheets being removed.

Thanks,

James


 
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
Detecting when a user deletes a row Wescotte Excel Programming 7 January 18th 06 04:26 PM
Detecting when a user deletes a row Wescotte Excel Worksheet Functions 0 November 8th 05 12:01 AM
Detecting when Excel user inserts or deletes a row wjewell Excel Programming 3 November 2nd 05 09:02 AM
Detecting user idle time R Avery[_2_] Excel Programming 1 May 3rd 05 06:34 PM
Detecting when user deselects an add-in mark Excel Programming 4 April 27th 05 09:51 PM


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

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

About Us

"It's about Microsoft Excel"