Hi,
I have inserted a date stamp into my spreadsheet with the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("G:G").Column Then
Cells(.Row, "N").Value = Now()
End If
End With
Next Cell
End Sub
I want to unlock the column where the date stamp appears to prevent users from amending the time. However, after locking the relevant cells and choosing Tools>Protection>Protect Sheet in Excel, and protecting the sheet with a password, the macro stops working. Is there a way to lock / protect the date stamp values without ruining the macro? I’ve been advised to “run the macro inside Sub Auto_Close”, but I have no idea what this means? (My VB skills are elementary.) Can anyone help?
Many thanks,
Sam
I have inserted a date stamp into my spreadsheet with the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("G:G").Column Then
Cells(.Row, "N").Value = Now()
End If
End With
Next Cell
End Sub
I want to unlock the column where the date stamp appears to prevent users from amending the time. However, after locking the relevant cells and choosing Tools>Protection>Protect Sheet in Excel, and protecting the sheet with a password, the macro stops working. Is there a way to lock / protect the date stamp values without ruining the macro? I’ve been advised to “run the macro inside Sub Auto_Close”, but I have no idea what this means? (My VB skills are elementary.) Can anyone help?
Many thanks,
Sam