WORKFLOW
Programmatically Insert a Cell in a Notebook
After the Cell Being Evaluated...
Insert an input cell after the cell that is being evaluated:
![](Files/ProgrammaticallyInsertACellInANotebook.en/1.png)
Insert both a text cell and an input cell:
![](Files/ProgrammaticallyInsertACellInANotebook.en/2.png)
At the Current Selection...
Make a button that inserts a text cell at the current selection:
Use the button to insert a cell at the current selection:
![](Files/ProgrammaticallyInsertACellInANotebook.en/3.png)
Notes
Wrap the first argument of ExpressionCell with Defer to prevent it from evaluating:
NotebookWrite is a low-level function that requires low-level representations of typeset cells, typically constructed using Cell, BoxData and ToBoxes: