# How can I delete cells with error messages?

I'm new to Mathematica and am unfamiliar with the notebook interface. I haven't been able to delete cells with error messages.

For example, when I try to ask Mathematica to compute something, it returns a message like

Solve::nsmet: This system cannot be solved with the methods available to Solve

when it fails. Once I see that, instead of proceeding to the next line, I would like to highlight that error message (along with the erroneous command) and delete it. But Mathematica won't let me do it.

How do I do this the right way?

-
Select the cell you want to delete using the cell selectors, to the right of your window –  belisarius Sep 23 '12 at 0:40
You might find this question useful, too. –  Oleksandr R. Sep 23 '12 at 1:22
Thank to the both of you –  sidht Sep 23 '12 at 1:54

A notebook consists of a collection of input and output lines.

The output lines are where your results appear, they're not the results themselves. You can edit output lines, but then they become new input lines instead. Mathematica will remember the result from the now disappeared output line, and you can always get it back with the function

a = Out[n]


So, editing or deleting a result only deletes its representation, not the content. Even when you deleted a result in the notebook you can always recall it.

Notebook basics in Documentation Center
Notebooks and documents in Tutorial Collection

-
+1 as an image tells more than a thousand words. –  István Zachar Sep 26 '12 at 18:19

The error messages generated in the notebook use the "Message" style from the stylesheet. If you look at the corresponding entry in Core.nb (base definitions), you'll find that cells of this type have Editable -> False and CellAutoOverwrite->True:

What this means is that you cannot select the contents and edit it (or erase it), which is why your attempts failed. In addition, you don't have to delete your incorrect attempt and try again — you can just fix your mistake (typo/syntax error/whatever) and re-evaluate the input and this cell will be automatically overwritten (and will disappear if there are no errors).

Since you're new, you might also find this answer useful in learning some basic shortcuts to navigate around the notebook.

-