Cancel a macro already applied to all sheets

  • Thread starter Thread starter minrufeng
  • Start date Start date
M

minrufeng

I found that I can not undo my macro operation by just clicking a
button. Does anyone know how to cancel a macro action which is taken?
 
Unless the macro has an undo programmed into it (and most don't), you can close
the workbook without saving and then reopen.

You'll lose any changes since the last save--including what the macro did.
 
I've been trying to program an "undo" into a macro I wrote and I am having
trouble finding the resources. Is there an "undo" class/method or do I have
to manually create an undo rountine.

Dave Peterson said:
Unless the macro has an undo programmed into it (and most don't), you can close
the workbook without saving and then reopen.

You'll lose any changes since the last save--including what the macro did.
 
You have to keep track of the stuff you did and the stuff you want to be able to
undo.

But macros can do lots that can't be undone. If you delete a file (not move to
the recycle bin), if you format a disk, ....

John Walkenbach explains it in his power programming books.

And he shares that info (for free) at:
http://www.j-walk.com/ss/excel/tips/tip23.htm

Debra Dalgleish has a list of books at her site:
http://www.contextures.com/xlbooks.html
(including John's)


Rayo said:
I've been trying to program an "undo" into a macro I wrote and I am having
trouble finding the resources. Is there an "undo" class/method or do I have
to manually create an undo rountine.
 
Can you "tell" Excel to execute the undo code when the user clicks "Undo" or
does it ahve to be a separately executed macro?

Dave Peterson said:
You have to keep track of the stuff you did and the stuff you want to be able to
undo.

But macros can do lots that can't be undone. If you delete a file (not move to
the recycle bin), if you format a disk, ....

John Walkenbach explains it in his power programming books.

And he shares that info (for free) at:
http://www.j-walk.com/ss/excel/tips/tip23.htm

Debra Dalgleish has a list of books at her site:
http://www.contextures.com/xlbooks.html
(including John's)
 
You can tell excel what macro to use when the user hits the undo button.

That's what this line does:
Application.OnUndo "Undo the ZeroRange macro", "UndoZero"
(from John's sample code)



Rayo said:
Can you "tell" Excel to execute the undo code when the user clicks "Undo" or
does it ahve to be a separately executed macro?
 

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