+ Reply to Thread
Results 1 to 2 of 2

(CHANGED) Macro Undo Code

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    Alberta
    MS-Off Ver
    2010
    Posts
    15

    (CHANGED) Macro Undo Code

    Here is my effort to write a macro undo.

    First we must define a couple public variables in declarations:

    Please Login or Register  to view this content.
    Then define the routine to call at the beginning of our macro we want to add undo too:

    Please Login or Register  to view this content.
    Then we need to define our undo macro as follows:

    Please Login or Register  to view this content.
    And lastly, our macro that we want to add undo too needs this line before "End Sub":

    Please Login or Register  to view this content.
    Note that this code will only work on Macros that run on one sheet only, and those that do not create sheets (in which a simple delete the created sheet could easily be added)

    While I thought the world was great for this, I noticed a MAJOR bug that maybe someone could help me with:

    When the undo macro is run, upon deleting the original sheet in order to replace it with the copied one, all formulas in all sheets referencing the deleted sheet change their reference to #REF because the sheet is missing temporarily.

    I tried to add in the:
    Application.Calculation = xlCalculationManual
    Command to stop this but it doesn't work...

    Does anyone have any thoughts?

    Thanks

    Enjoy!
    Last edited by arlu1201; 10-12-2012 at 02:14 PM.

  2. #2
    Registered User
    Join Date
    11-16-2011
    Location
    Alberta
    MS-Off Ver
    2010
    Posts
    15

    Re: (CHANGED) Macro Undo Code

    123 views and no suggestions?

+ 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