This question already has an answer here:
I would like to use a Mathematica notebook as a printable document with conditional output. If the condition is true, some parts of the notebook should be printed; otherwise they should not be printed. The condition that controls printing might be set in a cell at the start of the notebook, but this cell should not be visible in the printed document.
How could I do this? I have looked into cells, input and output in the Documentation Center, but could not find what I needed.