how to undo after creating a macro in Excel

Always when I create a Macro in Excel, I am not able to "undo" or to use the command Ctr+Z. What am I doing wrong? What can I do to not desactivate the "undo" command?

Thank you!
|
Answer
Answer

Clearing the undo stack is an unfortunate side effect of running VBA code. You can't prevent it, but there are rather cumbersome ways to provide undo capability - see http://www.jkp-ads.com/Articles/UndoWithVBA00.asp

---
Kind regards, HansV
https://www.eileenslounge.com

3 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Answer
Answer

You cannot Undo changes that are made with code.

When testing code you should frequently save the Workbook with version numbers. Ensure  you save before running the code and then if necessary you can close the workbook without saving and re-open the saved version.

Added with Edit: Also I always try to code so that existing (or source data) is not changed. This is done by having Source data on one worksheet and Output data on another worksheet. This may not always be practical but wherever possible it should be done this way.

Regards,

OssieMac

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated May 12, 2021 Views 15,247 Applies to: