I have a code for auto populating column B cells when column A is populated. Then the cells are automatically locked after data entry. My cells all lock fine except for column B cells which auto-populate from column A. Is column B not seeing the text in the cells and therefore will not lock because it doesn't recognize data has been entered? Also the date/time that auto-populates is in military time, not regular time and it does not display a.m. or p.m. Any suggestions on how to modify this code to make these things work properly? Thank you so much for any help.
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
ActiveSheet.Unprotect "Password"
Target.Locked = True
ActiveSheet.Protect "Password"
End Sub