Option Explicit
Sub undo_macro()
'Erik Van Geit
'050411 0109
Dim act_sh As Object, temp_sh As Object
Dim act_sh_n
With Application
.ScreenUpdating = False
.EnableCancelKey = False
End With
Set act_sh = ActiveSheet
act_sh_n = ActiveSheet.Name
act_sh.Copy After:=Sheets(Sheets.Count)
Set temp_sh = ActiveSheet
temp_sh.Visible = False
'code
'this line is just an example
act_sh.Activate
Range("A1") = "new entry"
With Application
.ScreenUpdating = True
.ScreenUpdating = False
.DisplayAlerts = False
End With
If MsgBox("Do you accept the changes", 36, "ACCEPT") = vbYes Then
temp_sh.Delete
act_sh.Activate
Else
act_sh.Delete
With temp_sh
.Visible = True
.Name = act_sh_n
.Activate
End With
End If
With Application
.ScreenUpdating = True
.EnableCancelKey = True
End With
End Sub