I have merged cells in a Notebook file.

Is there a way to split such a merged cell group back to single cells, in each of them being one command?

  • 5
    $\begingroup$ Try right-clicking somewhere in the cell and than select Divide Cell or left-click somewhere in the cell and than press Shift+Ctrl+D. $\endgroup$
    – Karsten7
    Jun 29, 2015 at 16:53
  • $\begingroup$ It is important not to mark the cell (not like one would do when merging). $\endgroup$
    – Karsten7
    Jun 29, 2015 at 16:55

1 Answer 1


Put this code after your merged cell and evaluate, it should print below all expressions separately.

I don't know how solid it is but worth a try:

  Scan[NotebookWrite[EvaluationNotebook[], Cell[#, "Input"]] &, #] &,
  DeleteCases[#, "\[IndentingNewLine]" | "\n", {2}] &,

] @ PreviousCell[]
  • 1
    $\begingroup$ Nice method. You might take style e.g. "Input" from the original Cell style instead to make this more robust. $\endgroup$
    – Mr.Wizard
    Jul 1, 2015 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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