View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Trigger macro when nr of sheets changes

Try this alternative solution, and let us know if it causes any other
problems

Dim NumSheets

Private Sub Workbook_Open()
NumSheets = ThisWorkbook.Sheets.Count
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim sActive As Object
If ThisWorkbook.Sheets.Count < NumSheets Then
NumSheets = ThisWorkbook.Sheets.Count
MsgBox ActiveSheet.Name
End If
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Workbook_SheetActivate ActiveSheet
End Sub


The Purbecks clouded over :-))

Bob

(remove nothere from email address if mailing direct)

"Sige" wrote in message
oups.com...
Oops.

1.A bit too fast ... : When deleting a sheet ...it triggers ...but
only when clicking another sheet first.