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 edited file; when you are asked if you want to save the changes, click No; then reopen it. The notebook reverts to the last version saved.