({{, (RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell])[notebook]
takes the current selection in a notebook and creates a new cell containing the result obtained by evaluating the contents of the selection using the kernel. }, {, (RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell])[notebook,sel]
sets the current selection after the evaluation to be as specified by sel. }})

OpenersNotesSection(Spacer1)Details

The first argument of (RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell]) is a (RefLink[NotebookObject, paclet:ref/NotebookObject]).

Possible settings for sel are as in (RefLink[NotebookWrite, paclet:ref/NotebookWrite]).

The default for sel is (RefLink[After, paclet:ref/After]).

(RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell])[notebook,(RefLink[All, paclet:ref/All])] sets the current selection to be the cell corresponding to the result from the evaluation.

(RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell]) performs the same underlying operation as typing (Key1[shift, MacOSXreturnenter]) in the front end. It does not, however, have side effects such as incrementing (RefLink[$Line, paclet:ref/$Line]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Evaluate an input cell and produce output beneath it:

nb=NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17","^","4"}]],"Input"]}]];

SelectionMove[nb,Next,Cell];

SelectionEvaluateCreateCell[nb]

OpenersExampleSection1(Spacer1)Scope  (2)

Make the selection be a point within an input cell:

nb=NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17","^","4"}]],"Input"]}]];

SelectionMove[nb,Before,CellContents];

(RefLink[SelectionEvaluateCreateCell, paclet:ref/SelectionEvaluateCreateCell]) takes the whole cell as input:

SelectionEvaluateCreateCell[nb]

Select multiple cells:

nb=NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17","^","3"}]],"Input"],Cell["text","Text"],Cell[BoxData[RowBox[{"17","^","4"}]],"Input"]}]];

SelectionMove[nb,All,Notebook]

Evaluate all the evaluatable cells in the selection:

SelectionEvaluateCreateCell[nb]

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[SelectionEvaluate, paclet:ref/SelectionEvaluate]) evaluates the selected expression in place:

nb=NotebookPut[Notebook[{Cell[BoxData[RowBox[{"17","^","4"}]],"Input"]}]];

SelectionMove[nb,All,CellContents]

SelectionEvaluate[nb]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SelectionEvaluate, paclet:ref/SelectionEvaluate])  ▪  (RefLink[SelectionCreateCell, paclet:ref/SelectionCreateCell])  ▪  (RefLink[NotebookEvaluate, paclet:ref/NotebookEvaluate])  ▪  (RefLink[NotebookRead, paclet:ref/NotebookRead])  ▪  (RefLink[NotebookWrite, paclet:ref/NotebookWrite])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Notebooks from the Kernel, paclet:tutorial/ManipulatingNotebooksFromTheKernel])}})}})