Search code examples
vbaexcelundo-redo

"Undo" history button clear after run macro excel


I have a macro that fires on the "Worksheet_SelectionChange" event. The macro validate data of one column, it changes the background color of the cell if its wrong.

The problem is after run the macro, it clears the history of changes (Ctrl Z) of all the document, even the history changes of other cells that I didnt validate.

How can I solve this problem?

Thanks.


Solution

  • As the others have stated, there is not way to stop a worksheet-changing macro from clearing the undo stack.

    As another side-effect, you can't undo the macro either without writing your own Undo routine, which can be a huge hassle.

    Here's to hoping MS changes this in the future.