Private Sub workbook_sheetchange(ByVal Sh As Object, ByVal target As Range)
Dim clickRng As Range
Dim lastRow As Long
lastRow = Range("e3").End(xlDown).Row
Set clickRng = Range("a3:d" & lastRow)
If Not Intersect(target, clickRng) Is Nothing And Cells(2, 1).Value = "AD&S Team" Then
If ActiveCell.Value = 1 Or ActiveCell.Value = 2 Or ActiveCell.Value = 3 Or ActiveCell.Value = 4 Then
ActiveCell.Value = 0
Else
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 4)).Value = 0
If ActiveCell.Column = 1 Then
ActiveCell.Value = 1
ElseIf ActiveCell.Column = 2 Then
ActiveCell.Value = 2
ElseIf ActiveCell.Column = 3 Then
ActiveCell.Value = 3
Else
ActiveCell.Value = 4
End If
End If
End If
End Sub
Application.EnableEvents = False
Application.EnableEvents = True
Private Sub workbook_sheetselectionchange(ByVal Sh As Object, ByVal target As Range)
Application.EnableEvents = False
Dim clickRng As Range
Dim lastRow As Long
lastRow = Range("e3").End(xlDown).Row
Set clickRng = Range("a3:d" & lastRow)
If InStr(target.Address, ":") > 0 Then
Exit Sub
End If
If Not Intersect(target, clickRng) Is Nothing And Cells(2, 1).Value = "AD&S Team" Then
If target.Value = 1 Or target.Value = 2 Or target.Value = 3 Or target.Value = 4 Then
target.Value = 0
Else
Range(Cells(target.Row, 1), Cells(target.Row, 4)).Value = 0
If target.Column = 1 Then
target.Value = 1
ElseIf target.Column = 2 Then
target.Value = 2
ElseIf target.Column = 3 Then
target.Value = 3
Else
target.Value = 4
End If
End If
End If
Application.EnableEvents = True
End Sub