For easy searching I copied the answer from Mr. Wizard
Please try this code, based on Sasha's adaption of my own answer to this question.
AutoCollapse := (
If[$FrontEnd =!= $Failed,
SelectionMove[EvaluationNotebook, All, GeneratedCell];
Then in a new cell:
2 + 2
AutoCollapse as the last line of an Input cell.
To get the behavior without having to include
AutoCollapse in each cell you can use Stylesheets and
CellEpilog. For example to create an
InputHidden style use menu Format > Edit Stylesheet... and then add a Cell with the following code (use Ctrl+Shift+E to edit Cell code):
Cell[StyleData["InputHidden", StyleDefinitions -> StyleData["Input"]],
CellEpilog :> (SelectionMove[EvaluationNotebook, All, GeneratedCell];
MenuSortingValue -> 1510
, MenuCommandKey -> "8"
This creates a new style that behaves like Input but which auto-collapses when evaluated.
MenuCommandKey -> "8" lets it be quickly applied using Alt+8; change or remove this line as desired.
I may be reading more into your question than is there. As Heike points you can close the input cells manually by deselecting menu
Cell > Cell Properties > Open but I assumed you knew this already and provided the soluition(?) above. If all you need is a hidden cell that generates output, use the menu. If you need something a little more flexible that automatically hides after you make your changes I hope you will find the methods above useful.