Locking specific cells in a workbook

S

Sarah

Hi there,
Somehow the way I know how to lock specific cells in a workbook isn't
working. can you remind me how to do it please?
Also, do you have to adjust the protection for each sheet individually? Or
is there a way to do the whole work book at once?
Thanks!
 
D

Dave Peterson

If you haven't changed anything, then each cell on the worksheet is locked.

You can select the cells you want unlocked and then
format|cells|protection tab|uncheck locked

But then you have to protect the worksheet.
Tools|Protection|Protect workbook
(Give it a memorable password if you want)

And you have to protect each sheet individually--or use a macro:

Option Explicit
Sub ProtectAllSheets()
dim wks as worksheet
dim myPWD as string
myPWD = "topSeCrEt"
for each wks in thisworkbook.worksheets
wks.protect password:=myPwd
next wks
End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
M

Max

Sarah said:
Somehow the way I know how to lock specific cells in a workbook isn't
working. can you remind me how to do it please?

The process would be:
1. Unlock all cells in the sheet first

Select the entire sheet,
Click Format > Cells > Protection tab
Uncheck "Locked" > OK
(As Dave pointed out, all cells are "locked" by default)

2. Lock those specific cells/ranges

Hold down CTRL key and multiselect all the specific cells/ranges
Click Format > Cells > Protection tab
Check "Locked" > OK

3. Apply sheet protection

Click Tools > Protection > Protect Sheet > Password? > OK
 
Top