Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Where is the Worksheet_Delete event?

Hi, All

Is anyone knows how to trap the (after/before) delete or add event on the
worksheet?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Where is the Worksheet_Delete event?

ex: add a row or delete a row on the worksheet

"OKLover" bl...
Hi, All

Is anyone knows how to trap the (after/before) delete or add event on the
worksheet?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Where is the Worksheet_Delete event?

Hi

There is no such event, sorry. An awkward workaround would be to hijack all
the Delete / Insert menus and assign your own macros to them.

HTH. Best wishes Harald


"OKLover" skrev i melding
...
ex: add a row or delete a row on the worksheet

"OKLover"

bl...
Hi, All

Is anyone knows how to trap the (after/before) delete or add event on

the
worksheet?





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Where is the Worksheet_Delete event?

Grüezi OKLover

OKLover schrieb am 02.07.2005

Is anyone knows how to trap the (after/before) delete or add event on the
worksheet?


As Harald mentioned - there is no such event.
....but whenever a sheet is added or deleted, Workbook_SheetActivate fires.

So in a module set the following line:

Public lngSheets As Long


and in 'This Workbook' the following two event-codes:

Private Sub Workbook_Open()
lngSheets = Sheets.Count
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Select Case Sheets.Count
Case Is lngSheets
MsgBox "there was a sheet added"
'add whatever you like
Case Is < lngSheets
MsgBox "there was a sheet deleted"
'add whatever you like
End Select
lngSheets = Sheets.Count
End Sub

Save, close and reopen the workbook and whenever a sheet is added or
deleted you'll get a message.


Mit freundlichen Grüssen
Thomas Ramel

--
- MVP für Microsoft-Excel -
[Win XP Pro SP-2 / xl2000 SP-3]
Microsoft Excel - Die ExpertenTipps:
(http://tinyurl.com/9ov3l und http://tinyurl.com/cmned)
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
How to trap delete row event and hide column event? Alan Excel Programming 3 April 26th 05 04:25 PM
Worksheet_Delete event? Cool Sport Excel Programming 4 February 21st 05 01:15 PM
user form-on open event? keydown event? FSt1[_3_] Excel Programming 2 August 5th 04 02:26 PM
Event Procedures: Event on Worksheet to fire Event on another Worksheet Kathryn Excel Programming 2 April 7th 04 07:35 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM


All times are GMT +1. The time now is 12:08 PM.

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"