LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Detect Delete

Hi,
I'm trying to write some code that detects whether someone has deleted data
using the delete key, on a particular sheet.
I use the following to catch data in the active cell before it is deleted,
and store it in AB2:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not IsEmpty(ActiveCell) Then Range("AB2") = ActiveCell.Value
End Sub

I don't mind if data is added or changed - I just want to know if it's been
deleted.
The delete-detect macro would display a message box telling the user that
they've been naughty, then use the value of AB2 to reinstate the deleted
data. This part I can do. I just can't seem to get the detect-delete part.

I have tried the following:

Private Sub Worksheet_Change(ByVal Target As Range)
If IsEmpty(ActiveCell) Then MsgBox _
"No manual deletions allowed on this page" _
& Chr(10) & "Use the Delete button in Cell H1"
End Sub

This displays the msgbox when I delete something, but it also displays when
I add data to a cell, then hit enter. Any way of doing what I want?

Any help would be appreciated.
Regards - Dave.


 
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
duplicate named ranges- how to detect, delete? Keith R Excel Discussion (Misc queries) 2 June 1st 07 04:41 PM
Detect Delete Column/Row vs Insert Otto Moehrbach Excel Programming 0 April 20th 06 02:08 PM
detect and delete existing sheet swiftcode Excel Discussion (Misc queries) 3 September 16th 05 05:20 PM
How to detect an insert/delete? Dave Peterson[_3_] Excel Programming 0 September 12th 03 03:38 AM
How to detect an entire column/row delete event? MV[_2_] Excel Programming 1 September 10th 03 01:03 PM


All times are GMT +1. The time now is 01:23 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"