NextCell

NextCell[]

returns the CellObject corresponding to the cell directly below the currently evaluating cell.

NextCell[cellobj]

starts looking from the given cell.

NextCell[NotebookSelection[nbobj]]

starts looking from the bottommost selected item.

Details and Options

  • The evaluation of NextCell will not result in the selection or insertion point changing position.
  • If the requested cell is not available or the bottom of the notebook is reached, NextCell will return None.
  • NextCell can return the first cell after the reference point that matches given criteria by specifying one or more of the following options:
  • CellIDcell IDs to match
    CellLabelIn/Out label strings to match
    CellStylenamed cell styles to match
    CellTagscell tags to match
    Evaluatorcells that match the specified evaluator
    GeneratedCellmatch only generated output cells if True, or only non-generated cells if False
  • NextCell[cellobj] of an inline cell will return the next inline cell in the same cell. NextCell[NotebookSelection[nbobj]] will always return the next regular cell, regardless of whether an inline cell is presently selected.

Examples

Basic Examples  (3)

Get the CellObject for the next cell:

Read the cell after this one into the kernel:

There are no "Section" style cells below this point in the notebook:

Wolfram Research (2014), NextCell, Wolfram Language function, https://reference.wolfram.com/language/ref/NextCell.html (updated 2020).

Text

Wolfram Research (2014), NextCell, Wolfram Language function, https://reference.wolfram.com/language/ref/NextCell.html (updated 2020).

CMS

Wolfram Language. 2014. "NextCell." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/NextCell.html.

APA

Wolfram Language. (2014). NextCell. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NextCell.html

BibTeX

@misc{reference.wolfram_2023_nextcell, author="Wolfram Research", title="{NextCell}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/NextCell.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_nextcell, organization={Wolfram Research}, title={NextCell}, year={2020}, url={https://reference.wolfram.com/language/ref/NextCell.html}, note=[Accessed: 19-March-2024 ]}