G
Guest
I have a date macro. It automatically puts the date into the cell left of the
cell that I put data into.
I works fine if I don't lock the cell, but does nothing it it's locked.
Here is the macro:
____________________________________________________________
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in Col C
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then 'can be modified, see below
n = Target.Row
If Excel.Range("C" & n).Value <> "" Then
Excel.Range("B" & n).Value = Date
Target.Offset(0, 1).NumberFormat = "mm-dd-yyyy"
End If
End If
enditall:
Application.EnableEvents = True
End Sub
__________________________________________________________________
Is there a workaround or something that I could add to the macro?
cell that I put data into.
I works fine if I don't lock the cell, but does nothing it it's locked.
Here is the macro:
____________________________________________________________
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in Col C
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then 'can be modified, see below
n = Target.Row
If Excel.Range("C" & n).Value <> "" Then
Excel.Range("B" & n).Value = Date
Target.Offset(0, 1).NumberFormat = "mm-dd-yyyy"
End If
End If
enditall:
Application.EnableEvents = True
End Sub
__________________________________________________________________
Is there a workaround or something that I could add to the macro?