Undo reverses the previous action.
You can only undo your most recent command. In general, you can undo the basic commands in the Edit menu as well as any typing you have done since your last action.
The only way to undo several actions at once is to go back to an earlier version of your file: close the file; when asked if you want to save the changes, click No; then reopen it. The notebook then reverts to the last version saved.
Keyboard shortcuts: z (Windows); z (Macintosh); z (X).