SelectionEvaluate[notebook]
replaces the current selection in a notebook with the result obtained by evaluating the contents of the selection in the kernel.
SelectionEvaluate[notebook,sel]
sets the current selection after the evaluation to be as specified by sel.
SelectionEvaluate
SelectionEvaluate[notebook]
replaces the current selection in a notebook with the result obtained by evaluating the contents of the selection in the kernel.
SelectionEvaluate[notebook,sel]
sets the current selection after the evaluation to be as specified by sel.
Details
- The first argument of SelectionEvaluate is a NotebookObject.
- Possible settings for sel are as in NotebookWrite.
- The default for sel is After.
- Unless sel is None, the current selection after evaluation is complete will always be as specified by sel, even if you moved the selection interactively in the front end during the course of the evaluation.
Examples
open all close allBasic Examples (1)
Scope (3)
Create a notebook and select an expression within it:
nb = NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17", "^", "4"}]], "Input"]}]];SelectionMove[nb, All, CellContents]Evaluate the expression in place and select the written data:
SelectionEvaluate[nb, All]NotebookClose[nb]Create a notebook and select an expression within it:
nb = NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17", "^", "4"}]], "Input"]}]];SelectionMove[nb, All, CellContents]Evaluate the expression in place and move the selection "Before" the written data:
SelectionEvaluate[nb, "Before"]Create a notebook and select an expression within it:
nb = NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17", "^", "4"}]], "Input"]}]];SelectionMove[nb, All, CellContents]Evaluate the expression in place and move the selection "After" the written data:
SelectionEvaluate[nb, "After"]Properties & Relations (1)
To evaluate an input cell and produce output beneath it, use SelectionEvaluateCreateCell:
nb = NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17", "^", "4"}]], "Input"]}]];SelectionMove[nb, Next, Cell];SelectionEvaluateCreateCell[nb]Tech Notes
Related Guides
Related Workflows
- Evaluate an Expression in Place
History
Introduced in 1996 (3.0)
Text
Wolfram Research (1996), SelectionEvaluate, Wolfram Language function, https://reference.wolfram.com/language/ref/SelectionEvaluate.html.
CMS
Wolfram Language. 1996. "SelectionEvaluate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SelectionEvaluate.html.
APA
Wolfram Language. (1996). SelectionEvaluate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SelectionEvaluate.html
BibTeX
@misc{reference.wolfram_2026_selectionevaluate, author="Wolfram Research", title="{SelectionEvaluate}", year="1996", howpublished="\url{https://reference.wolfram.com/language/ref/SelectionEvaluate.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_selectionevaluate, organization={Wolfram Research}, title={SelectionEvaluate}, year={1996}, url={https://reference.wolfram.com/language/ref/SelectionEvaluate.html}, note=[Accessed: 12-June-2026]}