Selecting a subsection cell

*To*: mathgroup at smc.vnet.net*Subject*: [mg22849] Selecting a subsection cell*From*: "Tom De Vries" <tdevries at shop.westworld.ca>*Date*: Sat, 1 Apr 2000 02:51:10 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Hello All, I am hoping someone can help me with this. I am not understanding something about how to select a group of cells under program control. Here is what I would like to be able to do. I have a notebook with many Section cells. In each of these section cells is also a subsection cell. The application is a notebook with Math questions for a test. Each question is a section cell, and the answer is a subsection within the section cell. So each question is contained in its own section. Question 1 (section heading) What is 2 + 2? Answer (subsection heading) 4 Question 2 (section heading) What is 2 x 2? Answer (subsection heading) 4 Question 3 (section heading) What is 2 - 2? Answer 0 etc. I would like to be able to quickly delete all the answers. I tried giving each subsection heading cell a cell tag of answer. Then I tried the following (assuming the notebook I am working on can be referred to as fred) NotebookFind [fred, "answer", All, {CellTags}] This works fine, all the answer subsection headings get selected (This can also be done easily by simply option clicking on a cell that has a subsection style) Now, what I would really like to do is simply extend the selection so it encompasses the subsection and then I can delete all the answers at the same time. However, SelectionMove[fred, All, CellGroup] didn't do what I thought it would, at least not for me. For the first question in the notebook it did work, it selected just the answer (the subsection) part of the cell, but for all the other cells, it selected the whole question. I am not sure if my message makes sense, but if so, can anyone offer any suggestions or tell me what I am doing wrong? Thanks for any assistance you might provide. Sincerely, Tom De Vries Edmonton, Alberta Canada