Hi guys,
is there a function that can undo Visual Basic commands??
After executing a macro is there a function that can undo the workbook (Other than saving the workbook before the execution of the macro)
Thanks for your help
Hi guys,
is there a function that can undo Visual Basic commands??
After executing a macro is there a function that can undo the workbook (Other than saving the workbook before the execution of the macro)
Thanks for your help
Last edited by pierre08; 06-15-2010 at 05:00 AM.
Running VBA any code clears the Undo stack therefore preventing anything being 'undone'. You can use Application.Undo immediately in a worksheet change event if someone has entered a value you don't want them to for example but that's about it.
I've seen code that builds up a history of changes that then allows a custom undo routine to be used but never really tried it myself and don't think it's ever that perfect.
I thought I'd read somewhere that things might have changed in Excel 2010 (don't quote me on that though as not seen it yet).
Dom
Last edited by Domski; 06-15-2010 at 04:49 AM.
"May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."
Use code tags when posting your VBA code: [code] Your code here [/code]
Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.
They have made some changes to undo/redo in 2010 but doesn't look like that includes anything to do with code: http://blogs.msdn.com/b/excel/archiv...05/477660.aspx
Not surprised really.
Dom
No - you have to write another macro that undoes everything you just did and then assign it using Application.OnUndo. See this J-Walk tip for example.
Everyone who confuses correlation and causation ends up dead.
Thank you so much i have found the right code, thanks you
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks