View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary[_2_] Gary[_2_] is offline
external usenet poster
 
Posts: 32
Default Prevent edit of cells

ActiveSheet.Unprotect Password:="password"

(your current code)

ActiveSheet.Protect Password:="password"
Else: MsgBox "The cell can not be edited"
End If
End Sub

Protect the sheet with the password you have mentioned in the code.

hope this helps
Thanks.


"Freshman" wrote in message
...
Dear experts,

I've a worksheet with a macro which when users fill-in column A, auto
current dates and times appear in columns B & C respectively. I want after
the dates and times filled into cells in columns B & C, they cannot be
edited
anymore. I tried to lock the cells by "Protection" but a run-time error
dialog box appeared. Is there a way to solve this problem? Please advise.

Thanks in advance.