How do I access each cell in a range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a workbook set up to use in a classroom setting with multiple choice
answers. I have unlocked the answer boxes and protected the sheet. All
works nicely. Now I would like to have each student remove their answers
leaving the workbook for the next student. Before the protection I used a
macro selecting a range of cells in the answer columns and clearing the
cells. How can I move down the range and clear only the unlocked cells?
 
try this

Sub chgunlocked()
For Each c In Selection
If c.Locked = False Then c.Value = 11
Next
End Sub
 
Dim cell As Range
On Error Resume Next
For Each cell In ActiveSheet.UsedRange
cell.ClearContents
Next cell
On Error GoTo 0


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Thanks. I replaced the 11 with "" (quotes), copied the for next loop into my
macro and it worked. Now I don't have to worry about little fingers messing
up my excel sheet which lets the children in my Sunday School class work on
their Bible knowledge. Grandma Barb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top