D
DataGuy
Hi,
Project: Compensation Tool for the companies review/promotion.
I have built a table so that it when a change is made it records the change
made on the individual line item (first code) and I also have put a time
stamp if any change is made to the entire spreadsheet (second code). I sent
the comp tool out for my co-workers to test it. When they enter #s for new
salaries, they get a error to debug and it does not record the date and time.
I do not get this error. Can someone let me know what is wrong with my
code? I believe the error is in this line (.NumberFormat = "mm/dd/yyyy
[$-409]h:mm:ss AM/PM;@"). Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRow As Long
If Target.Cells.Count > 1 Then
Exit Sub 'one cell at a time
End If
If Application.Intersect(Target, Me.Range("AD12:AN76")) Is Nothing Then
'do nothing
Else
myRow = Target.Row
With Me.Cells(myRow, "AO")
.NumberFormat = "mm/dd/yyyy [$-409]h:mm:ss AM/PM;@"
Application.EnableEvents = False
.Value = Now
Application.EnableEvents = True
End With
End If
Application.EnableEvents = False
Range("C7").Value = Now
Application.EnableEvents = True
End Sub
Project: Compensation Tool for the companies review/promotion.
I have built a table so that it when a change is made it records the change
made on the individual line item (first code) and I also have put a time
stamp if any change is made to the entire spreadsheet (second code). I sent
the comp tool out for my co-workers to test it. When they enter #s for new
salaries, they get a error to debug and it does not record the date and time.
I do not get this error. Can someone let me know what is wrong with my
code? I believe the error is in this line (.NumberFormat = "mm/dd/yyyy
[$-409]h:mm:ss AM/PM;@"). Thanks.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRow As Long
If Target.Cells.Count > 1 Then
Exit Sub 'one cell at a time
End If
If Application.Intersect(Target, Me.Range("AD12:AN76")) Is Nothing Then
'do nothing
Else
myRow = Target.Row
With Me.Cells(myRow, "AO")
.NumberFormat = "mm/dd/yyyy [$-409]h:mm:ss AM/PM;@"
Application.EnableEvents = False
.Value = Now
Application.EnableEvents = True
End With
End If
Application.EnableEvents = False
Range("C7").Value = Now
Application.EnableEvents = True
End Sub