2
$\begingroup$

I can count how many cells there are in a notebook up to and including the one whose ID i need, and then evaluate Cells[EvaluationNotebook[]][[number, 1]].

How to do this simpler? And how to get a list of cell IDs when a number of cells are selected?

$\endgroup$
3
  • $\begingroup$ CurrentValue[#, CellID] & /@ SelectedCells[InputNotebook[]] is this what you want? $\endgroup$
    – Kuba
    Commented Feb 19, 2018 at 12:32
  • $\begingroup$ @Kuba Thank you Dynamic[SelectedCells[EvaluationNotebook[]][[All, 1]], UpdateInterval -> 1] works. I get ID number 4929, but confusingly CurrentValue[CellObject[4929], "CellID"] evaluates to 0. $\endgroup$
    – MeMyselfI
    Commented Feb 19, 2018 at 12:46
  • 2
    $\begingroup$ CellID option and CellObject's id are not the same thing. It would be good to know what do you want at the end. $\endgroup$
    – Kuba
    Commented Feb 19, 2018 at 12:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.