Hi,
I'm trying to have a cell record the daystamp when another is changed. However, I only want to record it if the letter "A" is inputted in the column and if anything else is inputted, nothing happens. Right it records everything. Reason is so I can calculate time difference.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Long
Application.EnableEvents = False
If Not Intersect(Target, Range("G:G")) Is Nothing And _
Target.Columns.Count < Columns.Count Then
On Error Resume Next
For Each cell In Intersect(Target, Range("G:G"))
cell.Offset(0, 54) = Format(Date, "MM/DD")
Next cell
End If
Application.EnableEvents = True
End Sub
Figured it out. Just had to put an IF loop statement.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Long
On Error Resume Next
Application.EnableEvents = False
If Not Intersect(Target, Range("G2:G2000")) Is Nothing And _
Target.Columns.Count < Columns.Count Then
On Error Resume Next
For Each cell In Intersect(Target, Range("G2:G2000"))
If cell.Value = "A" Then
cell.Offset(0, 54) = Format(Date, "MM/DD/YY")
cell.Offset(0, 62) = Format(Date, "MM/DD/YY")
ElseIf cell.Value = "M" Then
cell.Offset(0, 56) = Format(Date, "MM/DD/YY")
cell.Offset(0, 62) = Format(Date, "MM/DD/YY")
ElseIf cell.Value = "AI" Then
cell.Offset(0, 58) = Format(Date, "MM/DD/YY")
cell.Offset(0, 62) = Format(Date, "MM/DD/YY")
End If
Next cell
End If
Application.EnableEvents = True
End Sub
Bookmarks