Is there any way to automatically evaluate an input cell after evaluating the previous one without the need to press ENTER?
Answer
One way to acheive this is:
a = 1 + 2
If[a == 3, SelectionMove[EvaluationNotebook[], Next, Cell]];
SelectionEvaluate[EvaluationNotebook[]];
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"];
SelectionEvaluate[EvaluationNotebook[]]
]
This seems to be more bulletproof.
Comments
Post a Comment