Undo not working with macro

  • Thread starter Thread starter jbchrist
  • Start date Start date
J

jbchrist

Hello!

I am creating a macro that modifies some data. I have just notice
that the undo feature isn't available after I use my macro. (I can'
undo what my macro just did)

Is there a line of code that I have to include in my macro o
something?? :confused:


Thanks
Joh
 
John

not much you can do. Running a macro resets the Undo stack. I suppose, if
you think about it, that's logical, as your macro could do an awful lot of
things that might or might not need to be undone.

Regards

Trevor
 
Hi John

A macro can do tons of dramatic stuff, like deleting tons of folders,
subfolders and files. An Undo library would have to bee just too huge to
have.

So you'll have to manually (aka write code for) register and save the macro
actions and also write an "undo" macro for this. Typically it would be to
save a copy of the workbook at the stage of macro start, and for Undo
replace the workbook with this backup copy. But it all depends what the
macro does. If it just changes a single cell, go for an easier solution.

HTH. Best wishes Harald
 
Back
Top