View Single Post
  #7   Report Post  
newbie
 
Posts: n/a
Default

KL,

Thanks for the clarification.

I must still be doing something wrong though as I kepp getting the following
error;

"Compile Error: Member already exists in an object module from which this
object module derives".

And it has highlighted "Password =" on the first line of the script.

Thanks,

"KL" wrote:

Right-click on any sheet's name tab at the bottom of the window and select
View Code - the VBE window will appear. Double-click on ThisWorkbook object
in the Project Explorer - the workbook's module will open in the right
window. Copy the code there.

Regards,
KL

"newbie" wrote in message
...
KL...

Sorry, but what is the "workbook module"?

Thanks,

"KL" wrote:

How about something like this (you need to copy this into the Workbook
module).
Regards,
KL

'--------------Code Start--------------
Const Password = "" '<=Your password here if any

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
'Prevent multicell selections.
If Target.Count 1 Then ActiveCell.Select
ActiveSheet.Unprotect Password
If IsEmpty(ActiveCell) Then
ActiveCell.Locked = False
Else
ActiveCell.Locked = True
End If
ActiveSheet.Protect Password
End Sub

'--------------Code Finish--------------

"newbie" wrote in message
...
Is it possible to protect a cell if the value is not equal to zero or
blank?

I am using Excel 2002 and want to allow people to be able to enter
values
into the worksheet, but once they have been entered, I do not want them
to
be
changed.

Thanks,