Sub çàäàíèå3()
Dim List As Object
Dim List2 As Object
Set List = Worksheets("Êòî åäåò")
Set List2 = Worksheets("Êîìàíäèðîâêè")
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim n As Date
Dim m As Date
Dim c As Date
lLastCol = List.Cells(2, 1).CurrentRegion.Rows.Count
JLastCol = List2.Cells(2, 1).CurrentRegion.Rows.Count
For i = 2 To lLastCol '- 1
For j = i + 1 To lLastCol
If List.Cells(i, 2) = List.Cells(j, 2) Then
a = List.Cells(i, 1)
b = List.Cells(j, 1)
End If
For k = 2 To JLastCol
If List2.Cells(k, 1) = a Then
m = List2.Cells(k, 2)
End If
If List2.Cells(k, 1) = b Then
n = List2.Cells(k, 2)
End If
c = m + List2.Cells(k, 3)
If c > n Then
List.Cells(i, 1).Delete
List.Cells(i, 2).Delete
End If
Next k
Next j
Next i
End Sub