Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get the style such as Input, Text, Code, etc., of a selected cell? If a group of cells is selected, how can I get styles of all the cells in the group?

share|improve this question
Programmatically? If it's just one cell, then a manual method: you can right-click on the cell's bracket, mouse over to "Style", and then see what's ticked... – J. M. Mar 23 '13 at 16:09
@J.M. yes programmatically. I wasn't precise. – Vladimir Mar 23 '13 at 17:58
up vote 13 down vote accepted
"Style" /. Developer`CellInformation[nb]

where nb is the NotebookObject for the notebook you care about. Since you could have multiple cells selected, this will always return a list. It's also possible to have no cells selected, in which case CellInformation will return $Failed and the above code would throw an error.

share|improve this answer
God, it's even in the help and I couldn't find it.. Thanks! – Vladimir Mar 24 '13 at 18:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.