Protect cells after data entry
-
- NewLounger
- Posts: 8
- Joined: 10 Sep 2014, 19:23
Protect cells after data entry
Is there a way on the attached sheet to protect column E after data entry? Right now I have a code in there that will allow you to double click in column E for a time date stamp. I need to have the cell protected after that's done so no one can edit the time or date that's in there. Please help. password is "123"
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78647
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Protect cells after data entry
Welcome to Eileen's Lounge!
Try the following version of the Worksheet_BeforeDoubleClick event procedure:
Try the following version of the Worksheet_BeforeDoubleClick event procedure:
Code: Select all
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E:E")) Is Nothing Then
If Target.Locked = False Then
ActiveSheet.Unprotect Password:="123"
Target.Value = Now
Target.Locked = True
Target.Offset(0, 1).Select
ActiveSheet.Protect Password:="123", AllowInsertingRows:=True
Else
Beep
Cancel = True
End If
End If
End Sub
Best wishes,
Hans
Hans
-
- NewLounger
- Posts: 8
- Joined: 10 Sep 2014, 19:23
Re: Protect cells after data entry
YOU ARE THE ABSOLUTE BEST!! thank you so much for all your help and patience! :)
-
- Administrator
- Posts: 78647
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands