The Application object contains an OnUndo method which lets you specify the text you want to appear on the (Edit > Undo) menu
The 'Text' is the text to appear on the (Edit > Undo) menu and the 'Procedure' is the macro to run to undo the changes.
It also allows you to specify a procedure that will run if the user selects (Edit > Undo).
Use the OnUndo method as the last action in your macro.
It is not always easy to undo the effects of a subroutine.
Your subroutine will have to store the previous state and exactly how you do this will vary.
In extreme cases you may need to save the entire file.
If your subroutine modifiers a particular range then you will only need to save that particular range.
This method does not exist in Word at the moment.
This method does not exist in PowerPoint at the moment.