Public r As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("BM5:BO80000")) Is Nothing Then
If Target.Value = "" Then
If r = "" Then Exit Sub
x = Application.Index(Sheets("Key").Range("C1:C20"), Application.Match(r, Sheets("Key").Range("B1:B20"), 0))
If x >= 1 Then Cells(Target.Row, x + 49).ClearContents
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(-1, 0).Select
Exit Sub
End If
x = Application.Index(Sheets("Key").Range("C1:C20"), Application.Match(Target.Value, Sheets("Key").Range("B1:B20"), 0))
If x >= 1 Then Cells(Target.Row, x + 49) = Date
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(-1, 0).Select
ElseIf Not Intersect(Target, Range("M5:M80000")) Is Nothing Then
If Target.Value = "" Then
If r = "" Then Exit Sub
Cells(Target.Row, 63).ClearContents
Cells(Target.Row, 64).ClearContents
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(-1, 0).Select
Exit Sub
End If
Dim b As Variant
' b = Split(Application.UserName, ",")(1)
Cells(Target.Row, 63) = Right(Split(Application.UserName, ",")(1), Len(Split(Application.UserName, ",")(1)) - 1)
Cells(Target.Row, 64) = Date
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(-1, 0).Select
' Cells(Target.Row, 62) = Date
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
r = Target
End Sub
getting error in the line
r = Target