![]() |
Signature Authentication
I am trying to make my excel sheet automatically give off the date and time
when some data is inputted into the cells next to it. I managed to do this with this code but wanted to add the security that the person signing off is actually authentic. I tried to insert your code into my previous code and it kept giving me "Method "Value" of Object "Range" failed". Do you have any suggestions? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo EndItAll Application.EnableEvents = False If Target.Cells.Column = 5 Or Target.Cells.Column = 8 Or Target.Cells.Column = 11 Then ActiveSheet.Unprotect Password:="justme" For Each cell In Target If cell.Value < "" Then With cell.Offset(0, 1) .Value = Now .Locked = True End With End If Next End If EndItAll: Application.EnableEvents = True 'ActiveSheet.Protect Password:="justme" Range("e2").Value = Environ("UserName") End Sub |
Signature Authentication
Hi Josh,
Try the following minor adaptation of your code: '=========== Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim rCell As Range Const PWORD As String = "justme" On Error GoTo EndItAll Application.EnableEvents = False With Me If Target.Cells.Column = 5 _ Or Target.Cells.Column = 8 _ Or Target.Cells.Column = 11 Then .Unprotect Password:=PWORD For Each rCell In Target.Cells If rCell.Value < "" Then With rCell.Offset(0, 1) .Value = Now .Locked = True End With End If Next End If EndItAll: .Range("E2").Value = Environ("UserName") .Protect Password:=PWORD Application.EnableEvents = True End With End Sub '<<=========== --- Regards. Norman "Josh" wrote in message ... I am trying to make my excel sheet automatically give off the date and time when some data is inputted into the cells next to it. I managed to do this with this code but wanted to add the security that the person signing off is actually authentic. I tried to insert your code into my previous code and it kept giving me "Method "Value" of Object "Range" failed". Do you have any suggestions? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo EndItAll Application.EnableEvents = False If Target.Cells.Column = 5 Or Target.Cells.Column = 8 Or Target.Cells.Column = 11 Then ActiveSheet.Unprotect Password:="justme" For Each cell In Target If cell.Value < "" Then With cell.Offset(0, 1) .Value = Now .Locked = True End With End If Next End If EndItAll: Application.EnableEvents = True 'ActiveSheet.Protect Password:="justme" Range("e2").Value = Environ("UserName") End Sub |
All times are GMT +1. The time now is 11:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com