Please help with Excel macro

By Tink! ·
I have a macro in Excel that is used to track changes in files.

It's a very basic script that makes the font change to red upon hitting ENTER.

The problem is that any changes done in a file running this macro cannot be undone by the UNDO command. It is not enabled.

How can I get it so that changes will still be Undo-able? In otherwords how do I enable Undo and/or keep it enabled throughout?

Thanks in advance for your help!
-Tink (did anyone miss me?)

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

link found from google

by robo_dev In reply to Please help with Excel ma ...

In order to allow the user to undo the effects of a macro, your macro must keep track of what was changed by the macro, and then restore the original state if the user selects Edit - Undo.

To enable the Edit - Undo command, use the OnUndo method as the last action in your macro. This method lets you specify text that will appear on the Undo menu item, and also specify a procedure to run if the user selected Edit - Undo. Here's an example:

Application.OnUndo "The Last Macro", "MyUndoMacro"

Related Discussions

Related Forums