how to undo changes made by micro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

After we change cell values with our micro procedures, we can not use the
undo button to resume previous values.
How can we undo changes made by our micro procedures, as if the changes are
made in excel spread sheet by hand?

Thanks!
 
Thank you, Tom.

In the link you provided, the approach actually undo one backward step
only. After one undo, the undo button becomes disable, and there is no way to
undo backward further with the undo button.
 
Dear Zhu,

i´m sorry: after the VBA-Program has run, it is game over. Further all
previous actions in the "Undo"-list are extinguished.

It is possible to define other macros within your program to be listed as
"Undo"-Actions. (Therefor they have to be defined at the very end of the
program by Application.OnUndo "Undo : change all values" ,"MacroXX").

Best regards, Kai
 
I don't have a canned solution for you. You get the point, however, that
you have to store the changes and write code to undo them. If you only set
up your code to do one level of undo, then you are restricted to one level.
If you write your code to handle more than one level, then you have more
than one level. The link shows you the basics. The link you posted shows
another implementation, but it is also storing the situation before the
change.

If you want to integrate the undo with the built in undo, so you can run a
macro, make manual changes, run a macro, make manual changes, then unless
you implement that all in your own code, you are correct that it won't work.
 
You can always close the file without saving. That, of course, does away
with all changes you have made, even the ones you wanted to keep.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top