View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Lock and Unlock Cells

One way:

Const sPWORD As String = "drowssap"
Dim ws As Worksheet
For Each ws In Worksheets
With ws
.Unprotect Password:=sPWORD
.Range("B16:D45").Locked = True
.Range("N16:N45").Locked = False
.Protect Password:=sPWORD
End With
Next ws

In article ,
"Peter" wrote:

I am trying to get my sheets to work as follows:

Unprotect the worksheet (with password)

Protect cell range B16,D45

Unprotect cell range N16,N45

Protect sheet (with password)

Then move to the next sheet in the Workbook and repeat the process.
There are 20+ Worksheets in the Workbook.