Highlight Active row

Chip is a *******jack programmer of the first order. If there was a way to keep from clearing the Undo stack, believe, Chip would know it. Almost any macro that does almost anything will clear the Undo stack. The problem is things you do via VBA do not ADD to the Undo stack. So Excel cannot UNDO anymore - to do so would wreak untold havoc.

I don't know why everyone (even very experienced people like yourself Greg) seems to take that line. You can very set your macros up to be undone. Take a look at the OnUndo property. I have been making my xla actions undoable for a while now.

http://msdn2.microsoft.com/en-us/library/aa195810(office.11).aspx
http://j-walk.com/ss/excel/tips/tip23.htm
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I don't know why everyone (even very experienced people like yourself Greg) seems to take that line. You can very set your macros up to be undone. Take a look at the OnUndo property. I have been making my xla actions undoable for a while now. In fact CP has a whole article about it... So I think he knows too. They are just a pain to set up, so he likely skipped it.

Aaron,

Quit skimmin'! Didn't say you cannot create your own UNDO. I have done that myself. But even if you do create your own UNDO, it does not retain the Undo stack. Unless I am mistaken (and I would be thrilled to be wrong), there is now way to append to the existing call stack. After you call App.OnUndo the undo stack is one action deep - that which you specified. Even if the undo stack was fifty deep before you called your macro and your macro only does one wee thing to a cell, the undo stack gets cleared (whether or not you call OnUndo).
 
You know Greg, now that someone has said it can't be done this is driving me crazy. Because I am sure that info is stored somewhere. I have used filemon and regmon to see if I could be so lucky but I am pretty sure the undo info is being stored in memory. If we could figure where, the undo stack doesn't get cleared until a macro changes the workbook. So you could copy the undo stack out of memory before any workbook changing action, then at the end, restore it.


Edit: Not a 100% positive it's not being stored in a tempfile have to double check here.
 
Last edited:
If you figure it out, let us know! Obviously it is being stored somewhere. I know that if you bump the registry setting to increase the size of the undo stack it does take more memory.

But I have to think that it would be pretty danged hard to lay your hands on it because in all honesty you would have to be one heck of a good programmer to properly write your OnUndo to completely roll back every change you've done if your macro did anything more than some pretty basic stuff.
 
I agree, it's doability would very much depend on how they plugged it in. If it's something simple you could just copy the values stored. Let them be cleared, then put the values back along with a reference calling your undo macro.
WinHex allows you to monitor what excel is doing to memory, so I'd imagine with time it could be figured out what and where it's storing it. I'm sure the offset location (or formula to derive the offset) would be static. The question then is figuring out how get the starting point the OS assigns it.
 
OK, I can confirm it is definitely in the memory but the offset is moving around. It actually stores the Undo Text and Function call in plain text. So you search for a garbage sequence until you find one not in memory then use that as the Undo Text and viola, the location.
So now that we know it's there it's a matter of figuring out the memory layout. With the offset moving around I thing it's going to be a little less trivial.
 
Hi, guys,

Interesting discussion :-)
About UNDO: it's true that running VBA, will disable Undo, but there are some tricks...
Example: You can make the current time running in a cell (for example, because I wouldn't do that in a project), while still having undo available. Time display stops when you are editing a cell, but afterwards again showing correct time.
Challenge: what's the trick? Very easy in fact. *

Do not forget, this is The Lounge :lol:

have a nice weekend,
Erik

* solution: http://www.mrexcel.com/forum/showthread.php?t=238323
 
Hi Erik :)
I'm not sure what you suggesting. Any change to a worksheet by a macro (called by OnTime or not) clears the undo stack. So even if you call the macro by OnTime, the undo stack will be cleared.
Or did I just completely fail to get what you were saying?

Oh, and Greg.... They make you live in a field?
 
Last edited:
Hey Erik,
Do you still have that bloody nose API joke code?
 

Forum statistics

Threads
1,222,684
Messages
6,167,630
Members
452,124
Latest member
lozdemr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top