6
$\begingroup$

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?

$\endgroup$
2
  • 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

6
$\begingroup$

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:

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

] @ PreviousCell[]
$\endgroup$
1
  • 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 you have read our privacy policy.

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