ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Undo function in Userform (https://www.excelbanter.com/excel-programming/372717-undo-function-userform.html)

Tyro[_5_]

Undo function in Userform
 
I'm a novice...this may be a simple one...
I have a Userform that allows adding /editing data in an Excel worksheet
which works fine.
I would like to provide an option in my Userform to UNDO it if they made a
mistake and revert back the
data back to its previous state. How and where should I code it under ?

Thanks a bunch!!
Tyro


stevebriz

Undo function in Userform
 
As far as I know...and happy to be told otherwise. but When using
macros/code to make changes you lose the ablity to undo...as a normal
operation.
The only way is reverse your code...or keep a copy on another sheet of
the step before last change and copy it across to the current sheet you
are editing.


Tyro wrote:
I'm a novice...this may be a simple one...
I have a Userform that allows adding /editing data in an Excel worksheet
which works fine.
I would like to provide an option in my Userform to UNDO it if they made a
mistake and revert back the
data back to its previous state. How and where should I code it under ?

Thanks a bunch!!
Tyro



Tom Ogilvy

Undo function in Userform
 
You would have to code is explicitly. That means you would have to record
what the previous values were before you change them. Then in your undo
routine, restore those values by writing them back to the appropriate cells.

There is no build in support for this. It is all done by your code.

--
Regards,
Tom Ogilvy


"Tyro" wrote:

I'm a novice...this may be a simple one...
I have a Userform that allows adding /editing data in an Excel worksheet
which works fine.
I would like to provide an option in my Userform to UNDO it if they made a
mistake and revert back the
data back to its previous state. How and where should I code it under ?

Thanks a bunch!!
Tyro



Tyro[_5_]

Undo function in Userform
 
Thanks for the feedback...I'll give that a try...it might take me a while to
get my
codings right or even make it work !! Thanks again !!


stevebriz wrote:
As far as I know...and happy to be told otherwise. but When using
macros/code to make changes you lose the ablity to undo...as a normal
operation.
The only way is reverse your code...or keep a copy on another sheet of
the step before last change and copy it across to the current sheet you
are editing.

I'm a novice...this may be a simple one...
I have a Userform that allows adding /editing data in an Excel worksheet

[quoted text clipped - 5 lines]
Thanks a bunch!!
Tyro



Tyro[_5_]

Undo function in Userform
 
Thanks for the feedback..!!...I'll try this option as well.. I'm following
the suggested logic,
it will probably just take me a while to code this properly. ..Thanks, again!


Tom Ogilvy wrote:
You would have to code is explicitly. That means you would have to record
what the previous values were before you change them. Then in your undo
routine, restore those values by writing them back to the appropriate cells.

There is no build in support for this. It is all done by your code.

I'm a novice...this may be a simple one...
I have a Userform that allows adding /editing data in an Excel worksheet

[quoted text clipped - 5 lines]
Thanks a bunch!!
Tyro




All times are GMT +1. The time now is 08:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com