PreviousCell

PreviousCell[]
returns the CellObject corresponding to the cell directly above the currently evaluating cell.

PreviousCell[cellobj]
starts looking from the given cell.

Details and OptionsDetails and Options

  • The evaluation of PreviousCell will not result in the selection or insertion point changing position.
  • If the requested cell is not available, PreviousCell will return None.
  • In the list returned by PreviousCell[cellobj,All], the first element will be the cell directly above the currently evaluating cell, the second element will be the cell previous to that one, and so on.
  • PreviousCell supports all the same options as Cells.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Get the CellObject for the previous cell:

In[1]:=
Click for copyable input
Out[1]=

Read this caption cell into the kernel:

In[1]:=
Click for copyable input
Out[1]=

There are no style cells above this point in this notebook:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2014
(10.0)