I'm trying to write my first, fairly short program in Mathematica (version 9.0, under Mac OS X.6.8) and am encountering problems with instructions not being performed in sequence. I'd appreciate help with straightening me out on what I'm doing wrong.

Here are two distilled snippets of the code, presented as two separate cells (indicated by the vertical bars on the left):

If I evaluate these cells one after the other I get the expected values for 'id' and 'fs'.

But if I merge them into one cell and evaluate it, the original 'id' and 'fs' values show up even before the dialog window, and of course they are not updated with the new values. How do I force sequential evaluation here?

The full program has six levels of nesting, so I put it all (100 lines) in one cell. Eventually I'll make it into a CDF file, but meanwhile what is the right way to handle this sort of situation?