+ Reply to Thread
Results 1 to 6 of 6

Cancel a macro already applied to all sheets

  1. #1
    Registered User
    Join Date
    08-11-2005
    Posts
    21

    Cancel a macro already applied to all sheets

    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?

  2. #2
    Dave Peterson
    Guest

    Re: Cancel a macro already applied to all sheets

    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.

    minrufeng wrote:
    >
    > 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?
    >
    > --
    > minrufeng
    > ------------------------------------------------------------------------
    > minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
    > View this thread: http://www.excelforum.com/showthread...hreadid=515038


    --

    Dave Peterson

  3. #3
    Rayo K
    Guest

    Re: Cancel a macro already applied to all sheets

    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" wrote:

    > 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.
    >
    > minrufeng wrote:
    > >
    > > 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?
    > >
    > > --
    > > minrufeng
    > > ------------------------------------------------------------------------
    > > minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
    > > View this thread: http://www.excelforum.com/showthread...hreadid=515038

    >
    > --
    >
    > Dave Peterson
    >


  4. #4
    Dave Peterson
    Guest

    Re: Cancel a macro already applied to all sheets

    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 K wrote:
    >
    > 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" wrote:
    >
    > > 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.
    > >
    > > minrufeng wrote:
    > > >
    > > > 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?
    > > >
    > > > --
    > > > minrufeng
    > > > ------------------------------------------------------------------------
    > > > minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
    > > > View this thread: http://www.excelforum.com/showthread...hreadid=515038

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

  5. #5
    Rayo K
    Guest

    Re: Cancel a macro already applied to all sheets

    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" wrote:

    > 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 K wrote:
    > >
    > > 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" wrote:
    > >
    > > > 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.
    > > >
    > > > minrufeng wrote:
    > > > >
    > > > > 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?
    > > > >
    > > > > --
    > > > > minrufeng
    > > > > ------------------------------------------------------------------------
    > > > > minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
    > > > > View this thread: http://www.excelforum.com/showthread...hreadid=515038
    > > >
    > > > --
    > > >
    > > > Dave Peterson
    > > >

    >
    > --
    >
    > Dave Peterson
    >


  6. #6
    Dave Peterson
    Guest

    Re: Cancel a macro already applied to all sheets

    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 K wrote:
    >
    > 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" wrote:
    >
    > > 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 K wrote:
    > > >
    > > > 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" wrote:
    > > >
    > > > > 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.
    > > > >
    > > > > minrufeng wrote:
    > > > > >
    > > > > > 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?
    > > > > >
    > > > > > --
    > > > > > minrufeng
    > > > > > ------------------------------------------------------------------------
    > > > > > minrufeng's Profile: http://www.excelforum.com/member.php...o&userid=26208
    > > > > > View this thread: http://www.excelforum.com/showthread...hreadid=515038
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson
    > > > >

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1