Here is my effort to write a macro undo.
First we must define a couple public variables in declarations:
Then define the routine to call at the beginning of our macro we want to add undo too:
Then we need to define our undo macro as follows:
And lastly, our macro that we want to add undo too needs this line before "End Sub":
Note that this code will only work on Macros that run on one sheet only, and those that do not create sheets (in which a simple delete the created sheet could easily be added)
While I thought the world was great for this, I noticed a MAJOR bug that maybe someone could help me with:
When the undo macro is run, upon deleting the original sheet in order to replace it with the copied one, all formulas in all sheets referencing the deleted sheet change their reference to #REF because the sheet is missing temporarily.
I tried to add in the:
Application.Calculation = xlCalculationManual
Command to stop this but it doesn't work...
Does anyone have any thoughts?
Thanks
Enjoy!
Bookmarks