below macro should give me current time in cell range 'O' when i add value in 'N' but its not giving any error or time in cell 'O'
pls help
pls help
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim irow As Long
If Not Intersect(Target, Range("I:I")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
irow = Target.Row
If IsEmpty(Target) Or IsEmpty(Target.Offset(0, -8)) Then
Target.Offset(0, 2).ClearContents
GoTo EndProc
End If
If IsDate(Target.Offset(0, 2)) Then GoTo EndProc
If Not IsEmpty(Target.Offset(0, -8)) Then
Target.Offset(0, 2) = Date
Else: GoTo EndProc
End If
If Not Intersect(Target, Range("N:N")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
irow = Target.Row
If IsEmpty(Target) Or IsEmpty(Target.Offset(0, -13)) Then
Target.Offset(0, 1).ClearContents
GoTo EndProc
End If
'If IsDate(Target.Offset(0, 1)) Then GoTo EndProc
If Not IsEmpty(Target.Offset(0, -13)) Then
Target.Offset(0, 1) = Time
Else: GoTo EndProc
End If
End If
End If
'---------------------------------
If Not Intersect(Target, Range("T:T")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
irow = Target.Row
If IsEmpty(Target) Then
Target.Offset(0, 1).ClearContents
GoTo EndProc
End If
If IsDate(Target.Offset(0, 3)) Then GoTo EndProc
If Not IsEmpty(Target.Offset(0, -19)) Then
Target.Offset(0, 1) = Date
Else: GoTo EndProc
End If
End If
EndProc:
Application.EnableEvents = True
End Sub