protect cells

  • Thread starter Thread starter JT
  • Start date Start date
J

JT

I have a macro that creates subtotals. I want to protect
several cells to the right of the subtotal so the user can
be prevented from entering any data in them.

I'm looking for suggestions how to accomplish this.
Thanks.
 
Hi
- select all cells
- goto 'Format - Cells - Protection' and uncheck 'Locked'

Now in your macro:
- set the .locked property of these cells to 'True'
- protect the sheet (e.g. activesheet.protect)
 
ActiveSheet.Unprotect
Cells.Locked = False
for each cell in Range("B4:B800")
if instr(1,cell.Text,"Subtotal",vbTextCompare) > 0 then
cell.offset(0,1).Resize(1,10).Locked = True
end if
Next
Activesheet.Protect
 
Lock the entire sheet, then Unlock the cells you want
people to be able to enter information into then protect
the sheet. This will allow the user to only enter data in
cells you want them to use.
 

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