ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Undo button (https://www.excelbanter.com/excel-programming/297276-undo-button.html)

Orf Bartrop

Undo button
 
I want to create an Undo button in a workbook. I know how to create the
button but not the code to go with it. How is this done.
The reason for the button is that all toolbars will be hidden in the
final product.

Orf Bartrop


Harald Staff

Undo button
 
Hi Orf

Pretty simple -but also pretty limited:

Sub RegretAction()
Application.Undo
End Sub

Note that Undo must be the very first command in a macro like this to work,
and that it's a strict "last action only" undo without the history. So
consider putting the built-in Undo button onto a new custom toolbar instead
and keep that one visible.

HTH. Best wishes Harald

"Orf Bartrop" skrev i melding
...
I want to create an Undo button in a workbook. I know how to create the
button but not the code to go with it. How is this done.
The reason for the button is that all toolbars will be hidden in the
final product.

Orf Bartrop




Orf Bartrop

Undo button
 
Thanks Harald. Your code is just what I wanted as there would only be
one undo required..

Harald Staff wrote:

Hi Orf

Pretty simple -but also pretty limited:

Sub RegretAction()
Application.Undo
End Sub

Note that Undo must be the very first command in a macro like this to work,
and that it's a strict "last action only" undo without the history. So
consider putting the built-in Undo button onto a new custom toolbar instead
and keep that one visible.

HTH. Best wishes Harald

"Orf Bartrop" skrev i melding
...


I want to create an Undo button in a workbook. I know how to create the
button but not the code to go with it. How is this done.
The reason for the button is that all toolbars will be hidden in the
final product.

Orf Bartrop











All times are GMT +1. The time now is 01:14 PM.

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