Hi,
I have applied the below code in the excel sheet, but it is giving result only for first 3 row and I am looking for results for rest row as well.
Please help me to resolve the error.
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Union(Range("C4:C162"), Range("D4:D162"))) Is Nothing Or Target.Value <> True Then Exit Sub
Debug.Print Target.Address
Dim HypTime As Date
Dim StartTime As Date, EndTime As Date
' get time period for changes
StartTime = Range("F1").Value
EndTime = Range("F2").Value
'set criteria met time
HypTime = Format(Now(), "hh:mm")
If (HypTime >= StartTime) And (HypTime <= EndTime) Then
' if True added between start and end times, add 1 to Number of Counts and record time
If Target.Column = 3 Then
Cells(Target.Row, 6) = Cells(Target.Row, 6) + 1
Cells(Target.Row, 7) = HypTime
ElseIf Target.Column = 4 Then
Cells(Target.Row, 8) = Cells(Target.Row, 8) + 1
Cells(Target.Row, 9) = HypTime
End If
End If
End Sub
Attached sheets for your reference.
Regards,