+ Reply to Thread
Results 1 to 3 of 3

Working macro but disables Undo

  1. #1
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Working macro but disables Undo

    I have copied some formula somewhere and adjusted it to what I need and the macro does what it needs to do.
    It simply widens the column when selected.

    However because of the nature of selectionchange thingy it also makes the Excel workbook unable to use "Undo" which is kinda annoying.
    anything I can do about this?


    Please Login or Register  to view this content.
    Last edited by Gaellus; 04-19-2021 at 10:27 AM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Working macro but disables Undo

    There is no way to preserve the undo stack. When a VBA macro is called, it clears Excel's undo stack. As I note in the discussion linked below, there could be value in exploring how important the VBA macro is to the project and balancing that against your desire to maintain an undo stack. If the macro is more important than the undo stack, then you use the macro with the understanding that you may not always have a functional undo stack. If the undo stack is more important, then you need to find a non-macro way to accomplish what the macro is doing.

    The only way around this that I have seen is from this discussion, where you create a class module and procedures to effectively store the workbook state with procedures to retrieve the stored information: https://www.excelforum.com/excel-pro...tion-back.html While you are running cost-benefit analyses on this programming task, see if it is worth the effort to implement this option.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Contributor
    Join Date
    11-20-2014
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    177

    Re: Working macro but disables Undo

    Quote Originally Posted by MrShorty View Post
    There is no way to preserve the undo stack. When a VBA macro is called, it clears Excel's undo stack. As I note in the discussion linked below, there could be value in exploring how important the VBA macro is to the project and balancing that against your desire to maintain an undo stack. If the macro is more important than the undo stack, then you use the macro with the understanding that you may not always have a functional undo stack. If the undo stack is more important, then you need to find a non-macro way to accomplish what the macro is doing.

    The only way around this that I have seen is from this discussion, where you create a class module and procedures to effectively store the workbook state with procedures to retrieve the stored information: https://www.excelforum.com/excel-pro...tion-back.html While you are running cost-benefit analyses on this programming task, see if it is worth the effort to implement this option.
    Hm okay. Thats a clear answer. Thanks.
    Then i need to figure out whats more important

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Workbook Disables Common Functions after Macro Runs
    By Fenopie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-01-2016, 09:11 AM
  2. [SOLVED] VBA code disables "UNDO" function on spreadsheet
    By toolman_dustin in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2015, 12:17 PM
  3. Replies: 0
    Last Post: 11-22-2014, 05:02 PM
  4. [SOLVED] Sheet Protection Disables Insert Row ability of Macro
    By cheal2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2013, 12:22 PM
  5. Need some help on keeping UNDO/REDO working after running macro's. Almost there ;-)
    By onidarbe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2013, 02:00 PM
  6. Looking for different way to write a macro...SendKeys command disables NumLock key
    By morant05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-14-2011, 09:58 PM

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