In Jupyter notebook, there is a Run All Above (a certain cell) option. Is there something like Run All Above in Mathematica?

  • $\begingroup$ This seems to me like a dangerous way to run code. I would not do it myself. A better way is make a function of the code you want and explicitly call it. Or to run one cell, I select it and evaluate that one cell only. But that is just me. $\endgroup$
    – Nasser
    Apr 5, 2020 at 19:42

2 Answers 2


You may use functions from the Low-Level Notebook Programming guide.

SetAttributes[evaluateFromFirstCell, {HoldFirst}];
evaluateFromFirstCell[nb_NotebookObject : EvaluationNotebook[]] :=
 Module[{cells = Reverse@PreviousCell[EvaluationCell[], All, CellStyle -> "Input"]},
   SelectionMove[#, All, Cell];
    SelectionEvaluateCreateCell[nb]; &,

Then evaluating evaluateFromFirstCell[] in a notebook will evaluate all input cells that precede it.

Hope this helps.


Seems like there is a programmatic way to create a "Run all above", as described in answers this question about selection of above cells.


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