erik.van.geit said:
I've seen it because I downloaded the addin.
then provide the link please
let's be clear (again)
no operation using code (macro) can be "undone" unless the operation is logged some way
you tell us
a command for Undoing or Redoing of any value you just entered...
this can only be done when the value which has been replaced is stored somewhere
for multiple undo you can copy the sheet and hide it
when user selects "cancel all operations" the hidden sheet would replace the actual sheet ...
you tell us John WalkenBach has done this: FINE! but why do you expect others to search the internet if you already found something: just provide the link please!
little example (no userform, just normal module)
Code:
Option Explicit
Public OldValue As Variant
Public OldRange As Range
Sub replace_value()
OldValue = ActiveCell
Set OldRange = ActiveCell
ActiveCell.Value = Application.InputBox("Please enter something to add to " & ActiveCell.Address(0, 0), Title:="TITLE", Default:=ActiveCell)
End Sub
Sub undo()
OldRange.Value = OldValue
End Sub
Code:
I would like to know if anybody knew the code for this.
you've downloaded an add-in: isn't the code visible ?
kind regards,
Erik
http://www.j-walk.com/ss/dataform/index.htm
Eric, this is the file I downloaded and you will see the code is password protected. He's making you pay $20.00 for the CODE. However, the Data Form Entry can be dowloaded for free so you can see how he works in the "Undo/Redo method. Since I already did my version of a data form (lacking the Undo and Redo), I'm requesting if anybody out there knows the code to put this on ANY userform. I just want the code for this task not the whole data form code.
In his book (Page849, 2002 VBA Programming/Excel) I just found this and I will type out the question and his answer so I can get your feedback how to do this w/button on Userform:
CAN I LET THE USER UNDO MY MACRO?
Yes, but it's not something that can be done automatically. To enable the user to undo the effects of your macro, your VBA code module must keep track of what was changed by the macro and then be capable of restoring the original state if the user selects Edit-Undo.
To enable the Edit-Undo command, use the OnUndo method as the last action in your macro. This method enables you to specify text that will appear on the Undo menu item and also to specify a procedure to run if the user selects Edit-Undo. Here's an example:
Application.OnUndo "The Last Macro", "MyUndoMacro"
OK enough!
Thanks for your comments!