Hi!

I'm fairly new to VBA and typically just try to mesh code together that I find through google (some of which came from this site!)

What I'm looking to do is double-click on a locked cell, have a timestamp auto-populate, re-lock the cell, and have the workbook automatically save. I was able to get the following two codes to work separately, but I'm not experienced enough to make them work together.

Thank you in advance to anyone able to give me guidance on this!

- Noel













Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Not Intersect(Range("E:F"), Target) Is Nothing Then
Target = Now()
Target.NumberFormat = "hh:mm:ss AM/PM"
ActiveWorkbook.Save
End If
End Sub


Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range

Set MyRange = Intersect(Range("E:F"), Target)
If Not MyRange Is Nothing Then
Sheets("Production Log").Unprotect Password:="hello"
MyRange.Locked = True
Sheets("Production Log").Protect Password:="hello"
End If
End Sub