Is there any way to automatically evaluate an input cell after evaluating the previous one without the need to press ENTER?

  • 1
    $\begingroup$ Out of curiosity - is there a reason why you wouldn't want to put them into the same cell? $\endgroup$
    – Jonie
    Aug 7, 2013 at 5:16
  • 2
    $\begingroup$ @Jonie Because I want the next cell be evaluated only if certain conditions are met. I also want to separate the outputs. $\endgroup$
    – M6299
    Aug 7, 2013 at 5:20

1 Answer 1


One way to acheive this is:

a = 1 + 2
If[a == 3, SelectionMove[EvaluationNotebook[], Next, Cell]];

Other way is by adding CellTag to our "conditional" cell. Use Crtl+J on that cell or use menu: Cell > Cell Tags > Add/Remove... to add tag, here I used "only if".

And then:

a = 1 + 2;
If[a == 3,
   NotebookLocate["only if"];

This seems to be more bulletproof.

  • $\begingroup$ Thanks. Your solutions are exactly what I needed. $\endgroup$
    – M6299
    Aug 7, 2013 at 6:13
  • $\begingroup$ @M6299 You are welcome :) I'm glad you find it useful. $\endgroup$
    – Kuba
    Aug 7, 2013 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.