Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
Dim j As Integer
If (Range("P1")) = "" Then
If Not Intersect(Target, Range("N10:Z200")) Is Nothing Then
Range("A10:L240").Interior.ColorIndex = 0
Range("E10:I240") = ""
For i = 10 To 300
For j = 1 To 150
If Cells(i, 14) = "" Then
Exit For
End If
If Cells(i, 24) = ("AA") Then
Range(Cells(i, 1), Cells(i, 12)).Interior.Color = RGB(188, 121, 255)
ElseIf Cells(i, 24) = ("BB") Then
Range(Cells(i, 1), Cells(i, 12)).Interior.Color = RGB(248, 203, 173)
ElseIf Cells(i, 12) = ("CC") Then
Range(Cells(i, 1), Cells(i, 12)).Interior.Color = RGB(255, 45, 0)
End If
If Cells(i, 20) <> Worksheets(2).Cells(j, 2) And Cells(i, 20) <> "" Then
Cells(i, 5) = 7
Cells(i, 7) = 21
Cells(i, 9) = 21
End If
Next j
Next i
End If
Else
End If
End Sub