How to run all cells above current one?

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

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

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.