Hi everyone,
I'm not sure if anyone can help me with this one...
I am using the code below to capture the user's name in column AY and the date and time in column AZ.
The second half of the code is triggered if the word "Committed" is selected in the dropdown list in column BS.
This triggers a message box which reads "Your entry has been successfully committed" and then locks down the cells on the entire row.
However, I only want this to happen if the corresponding cell in column J is greater than zero.
If it is blank, I need a warning/message box to advise "Missing Reference", and upon clicking OK, the cell containing "Committed" is cleared and the code ends without locking the cells.
Private Sub Worksheet_Change(ByVal Target As Range)
**If Target.Count > 1 Then Exit Sub**
**If Not Intersect(Target, Range("I:BS")) Is Nothing Then**
**Application.EnableEvents = False**
**Application.EnableEvents = False**
**Me.Unprotect Password:="441131873"**
**Cells(Target.Row, "AY").Value = Environ("UserName")**
**Cells(Target.Row, "AZ").Value = Format(Now, "mm/dd/yyyy hh:mm:ss")**
**Me.Protect Password:="441131873"**
**Application.EnableEvents = True**
**End If**
**Dim r As Range**
**Dim c As Range**
**Set r = Intersect(Range("BS:BS"), Target)**
**If r Is Nothing Then Exit Sub**
**Application.EnableEvents = False**
**Me.Unprotect Password:="441131873"**
**For Each c In r**
**If UCase(c.Value) = "COMMITTED" Then**
**c.Select**
**MsgBox "Your entry has been successfully committed!"**
**c.EntireRow.Locked = True**
**End If**
**Next c**
**Me.Protect Password:="441131873"**
**Application.EnableEvents = True**
End Sub