+ Reply to Thread
Results 1 to 3 of 3

Undo a macro

  1. #1
    Forum Contributor
    Join Date
    01-29-2008
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    237

    Undo a macro

    Here is the question

    I have a couple of macros on a sheet within a workbook, that insert as master row and also deletes a row. These macros are working fine. One of my users has found that once you have deleted or inserted a row the undo and redo functions are disabled, now this came a problem when he deleted the wrong line and had to re enter the data.

    Is there away of undoing the actions of a macro like a normal undo/redo

    Thanks for all your help in the pass, great forum

    Gareth

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    re: Undo a macro

    Not without wholesale rewriting of your macros to include backing up data being deleted somewhere.

    Of course, unless your user or macro is also saving the sheet, you can always close the workbook without saving and reopen, everything's back to where it was last time you saved. That's at least something.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile re: Undo a macro

    Good evening drgogo
    Quote Originally Posted by drgogo View Post
    Is there away of undoing the actions of a macro like a normal undo/redo
    Further to JBeaucaire's answer, there are a couple of pages on John Walkenbachs pages explaining the situation and how to go about seting up an "undo" routine :
    http://spreadsheetpage.com/index.php..._undo_problem/
    http://spreadsheetpage.com/index.php...ba_subroutine/

    However Jan Karel Pieterse has come up with a generic undo routine which is available to download from here :
    http://www.jkp-ads.com/Articles/UndoWithVBA00.asp

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

+ 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