View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
William[_4_] William[_4_] is offline
external usenet poster
 
Posts: 2
Default Protect Sheet but enable cell ranges giving Error 1004 Unable to set

Hi,
I am using the following code to disable a worksheet so
that people cannot tamper with data on it as it is used
in formulas else where on the sheet but allow them to
enter data in allocated cells which is then worked on to
give a result. Using the following code gives me an error
1004 Unable to sey the locked property of the Range
Classes , the help file doen't seem to indicate the
reason.

Option Explicit
Sub auto_open()

Worksheets(1).Range("b3:b6").Locked = False 'data
entry cells
Worksheets(1).Range("f6:f8").Locked = False 'change
variables allow cells

Worksheets(1).Protect

Regards

End Sub