NotebookDelete[notebook]
deletes the current selection in the notebook corresponding to the specified notebook object.
NotebookDelete[obj]
deletes the given cell or box object.
NotebookDelete[{obj1,obj2,…}]
deletes all specified objects.
deletes the current selection in the current evaluation notebook.
NotebookDelete
NotebookDelete[notebook]
deletes the current selection in the notebook corresponding to the specified notebook object.
NotebookDelete[obj]
deletes the given cell or box object.
NotebookDelete[{obj1,obj2,…}]
deletes all specified objects.
deletes the current selection in the current evaluation notebook.
Details and Options
- NotebookDelete can take a NotebookObject, CellObject, or BoxObject.
- Using NotebookDelete on a NotebookObject is equivalent to using the Clear command on that notebook.
- After using NotebookDelete on a NotebookObject, the current selection becomes an insertion point at the position of the deleted material.
- Using NotebookDelete on one or more CellObject expressions will not change the selection unless the selection intersected with one of the specified cells.
- Deleting the selection in a NotebookObject will automatically scroll to the resulting selection unless the option setting AutoScroll->False is given.
Examples
open all close allBasic Examples (2)
nb = CreateDocument[{a, b, c}];SelectionMove[nb, Next, Cell]NotebookDelete[nb]Display a button that deletes its cell:
Button["delete", NotebookDelete[EvaluationCell[]]]Display a list of self-deleting buttons:
Table[Button["delete", NotebookDelete[EvaluationBox[]]], {10}]Scope (1)
nb = CreateWindow[DocumentNotebook[{CellGroup[{TextCell["Text", "Section"], TextCell["some text", "Text"]}], CellGroup[{TextCell["Next section", "Section"]}]}]];Move the selection to the first "T":
SelectionMove[nb, Before, CellContents];
SelectionMove[nb, All, Character]NotebookDelete[nb]SelectionMove[nb, All, CellGroup]NotebookDelete[nb]Properties & Relations (2)
Use SelectionMove to select a cell to be deleted:
Button["delete", SelectionMove[EvaluationCell[], All, Cell];NotebookDelete[]]Target a CellObject directly to delete it without changing the selection:
Button["delete", NotebookDelete[EvaluationCell[]]]AttachCell returns the CellObject for each cell it attaches:
obj1 = AttachCell[EvaluationCell[], "top", {Right, Top}];
obj2 = AttachCell[EvaluationCell[], "bottom", {Right, Bottom}];Delete multiple attached cells:
NotebookDelete[{obj1, obj2}];Tech Notes
Related Guides
Related Workflows
- Apply a Function to Cells in a Notebook
History
Introduced in 1996 (3.0) | Updated in 2012 (9.0)
Text
Wolfram Research (1996), NotebookDelete, Wolfram Language function, https://reference.wolfram.com/language/ref/NotebookDelete.html (updated 2012).
CMS
Wolfram Language. 1996. "NotebookDelete." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/NotebookDelete.html.
APA
Wolfram Language. (1996). NotebookDelete. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NotebookDelete.html
BibTeX
@misc{reference.wolfram_2026_notebookdelete, author="Wolfram Research", title="{NotebookDelete}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/NotebookDelete.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_notebookdelete, organization={Wolfram Research}, title={NotebookDelete}, year={2012}, url={https://reference.wolfram.com/language/ref/NotebookDelete.html}, note=[Accessed: 12-June-2026]}