View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ordnance1 ordnance1 is offline
external usenet poster
 
Posts: 52
Default Cell protection problem

I am running a routine to protect my worksheets so when the workbook is
opened all cell are locked and and can not be selected. I have set the format
of all cells to locked and under protection I have unselected "Select Locked
Cells".

The problem is that when the workbook opens the worksheets are protected but
you are able to select locked cells.

Here is the code that I run to protect the sheets:

Sub protect_all_sheets()
For Each w In ThisWorkbook.Worksheets
w.Protect Password:="Popcorn"
Next
End Sub

I run this as a BeforeClose under ThisWorkbook.