Sub kk()

Dim a As Long, b As Long, c As Long, d As Long

a = 10

Do While Cells(a, 2) <> " "

If Cells(a, 1) >= 9 And Cells(a - 1) <= 8 And Cells(a, 2) = Cells(a - 1, 2) Then

If Cells(a, "N") = 1 Then
Cells(a, "Y").Copy = Cells(a, "AA")
Cells(a, "Z").Copy = Cells(a, "AB")

End If



If Cells(a, "N") = 1 Or 2 Or 3 Then
Cells(a, "Z").Copy = Cells(a, "AB")
End If

Else: Cells(a, "AF") = "TRUE"

End If

a = a + 1

Loop

End Sub