I've got a long document and I suspect know that I mistakenly set some cell in the middle of the document to be an initialization cell, probably hidden inside multiple collapsed sections and subsections.

Is there some keyboard shortcut, menu item, or front end token that will take me to the next initialization cell in the notebook?

  • $\begingroup$ In version 11, initialization cells have a grey background. $\endgroup$ – Szabolcs Jan 31 '17 at 11:01
  • $\begingroup$ @Szabolcs I'm currently using v10, but I'm more concerned with situations where there are multiple collapsed sections and subsections and it would take a significant amount of time (including e.g. waiting for the front end to display graphics) to look for a gray background by opening and closing cell groups. $\endgroup$ – Emilio Pisanty Jan 31 '17 at 11:07
  • $\begingroup$ Strongly related answer (see solution at the bottom): mathematica.stackexchange.com/a/29242/280 $\endgroup$ – Alexey Popkov Oct 17 '19 at 17:16
Select[Cells[], CurrentValue[#, InitializationCell] &]

You can use SelectionMove or just click on those objects to go there.

And here is a palette:


  "To the next initialization cell",
  With[{nb = InputNotebook[]},
    SelectionMove[nb, Next, Cell, AutoScroll -> False];
      First[SelectedCells[nb]] === Last@Cells[nb]
      CurrentValue[NotebookSelection[nb], InitializationCell]
   SelectionMove[nb, All, Cell];

  Method -> "Queued",
  FrameMargins -> 15

Your Answer

