...
....
If, according to the OP, the entry is incorrect and not acceptable,
why would it matter that it is permanently erased or undone?
Because the PREVIOUS entry is likely to have been valid, and it may be
preferable to preserve an outdated valid entry than to change the
entry to "" (which isn't the same as clearing the cells contents -
that involves setting the FORMULA property to "" - setting the VALUE
property to "" makes the cell nonblank containing a zero-length
string).
I also just noticed that you made a common mistake: you failed to set
Application.EnableEvents to FALSE before and TRUE after modifying
Target, which would otherwise cause the event handler to trigger
itself. You didn't test your code?
I just tried the macro against a larger selection and multiple
individual selections and the only cell that was erased was the
active cell. I'm using Excel 2003 if that makes a difference. Does
this code work differently in Excel 2003 than other (earlier?)
versions?
....
You have to ENTER multiple cells at once, e.g., array formulas or
multiple cell entries using [Ctrl]+[Enter] or PASTING into a multiple
cell range. Maybe the first is unlikely since users wouldn't be
entering array formulas, the second unlikely because users wouldn't
know about it, but the third is quite possible, and you should learn
to accommodate it.
That is a valid point and I can't argue with it at all. I would
note, though, that company policy might make disabling macros on
company spreadsheets a thing not to do, . . .
And some companies have policies of no macros AT ALL, making event
handlers of purely academic interest.
Anyway, if you're going to propose event handlers, you should address
means of discouraging users from disabling macros.