• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

Excel Delete Event

I know that Excel doesn't provide an event for delete. So how can we detect whether user delete some rows or cells and know which ranges that user just delete (if possible, also provide a way to cancel that?
0
testn
Asked:
testn
  • 4
  • 2
  • 2
  • +3
1 Solution
 
GoBananaCommented:
And why, may I ask, do you want to do that? Why not simply lock cells that should not be deleted?

There is a change event. May that perhaps be of interest?Hard for me tell since I do not know your intentions with your excel model.

GoBanana
0
 
pauloaguiaCommented:
The change event won't necessarily be triggered by that. And when it is it's already too late.

If any of the events may help you it would be the SelectChange event. You could prevent a user from selecting those rows (to delete, copy, paste, whatever).

But I think you'd be better of by protecting the sheet as GoBanana suggested...

Paulo
0
 
macrodevCommented:
How about using "Track Changes"?

Click on the Tools menu...Track Changes...Highlight Changes

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
randomgurnCommented:
This is a problem I came across recently also.  I wanted to know if the shapes of certain ranges had changed.  I didn't actually get round to implementing it, but here is what I thought of:-

You can store each of your particular ranges in, say, an array.  These are just pointers to ranges, so they get automatically updated.  You can then use the WorksheetChange event, and check to see whether these ranges have changed shape.

Of course, that doesn't stop the user deleting the range...
0
 
testnAuthor Commented:
The app that I am developing is the app keep track of information. So if users delete something, it will popup to ask reasons why they want to delete. So that I can move the existing data to somewhere else and also keep the reason. That's why I need that event
0
 
pauloaguiaCommented:
How about this scenario:

* You protect the sheet.
* Whenever someone wants to delete something selects it and then presses a button on a toolbar (or a shortcut key combination that you assign to it such as Ctrl+X, for instance)
* A dialog box then pops up to allow the user to enter the information you want.
* The sheet is then unprotected, the cells deleted and the sheets gets reprotected again.

However with the sheet selected you'll loose the ability to change the cells values, widths, formating, etc. You won't loose the ability to insert new values if you do it right and use the change event to only lock the cells with values.

What do you think about this acenario?

Paulo
0
 
testnAuthor Commented:
I think it's too difficult. My users are ranging from a novice user to an expert. So I'm quite reluctant to do that.
0
 
pauloaguiaCommented:
It doesn't take an expert to press a button (I may have not explained properly. All those steps would be made automatically at the press of a button).

But if you think it's too hard then I won't go on with it.

It was worth to try anyway :)

Paulo
0
 
DigitalXtremeCommented:
testn has requested that this question be deleted and points refunded. If there are any objections to this action please post here within 72 hours or I will complete the action. Thank you. :)

DigitalXtreme
CS Moderator
0
 
pauloaguiaCommented:
I would like to suggest this question to be PAQ'd rather than deleted. What testn requested just can't be done but there are some (viable?) alternatives already posted here and that can be of some help for someone else.

Paulo
0
 
DigitalXtremeCommented:
question PAQ'ed and points refunded.

DigitalXtreme
CS Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now