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$ – Karsten 7. Jun 29 '15 at 16:53
  • $\begingroup$ It is important not to mark the cell (not like one would do when merging). $\endgroup$ – Karsten 7. Jun 29 '15 at 16:55

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[]
| improve this answer | |
  • 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 '15 at 7:58

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.