If p(a) > p(b) And a <= b Then
If p(z(1)) - n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(min(z(1), z(2)) + 10, max(z(1), z(2))) = "+"
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(min(z(1), z(2)) + 10, max(z(1), z(2))) = "-": s = s + 1
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)) + 10, max(z(2), z(3))) = "+"
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)) + 10, max(z(2), z(3))) = "-": s = s + 1
If p(z(3)) - n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(min(z(3), z(4)) + 10, max(z(3), z(4))) = "+"
If p(z(3)) + n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(min(z(3), z(4)) + 10, max(z(3), z(4))) = "-": s = s + 1
If p(z(4)) - n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(min(z(4), z(5)) + 10, max(z(4), z(5))) = "+"
If p(z(4)) + n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(min(z(4), z(5)) + 10, max(z(4), z(5))) = "-": s = s + 1
End If
If p(a) <= p(b) And a > b Then
If p(z(1)) - n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)) + 10, min(z(1), z(2))) = "-": s = s + 1
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)) + 10, min(z(1), z(2))) = "+"
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)) + 10, min(z(2), z(3))) = "-": s = s + 1
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)) + 10, min(z(2), z(3))) = "+"
If p(z(3)) - n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(max(z(3), z(4)) + 10, min(z(3), z(4))) = "-": s = s + 1
If p(z(3)) + n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(max(z(3), z(4)) + 10, min(z(3), z(4))) = "+"
If p(z(4)) - n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(max(z(4), z(5)) + 10, min(z(4), z(5))) = "-": s = s + 1
If p(z(4)) + n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(max(z(4), z(5)) + 10, min(z(4), z(5))) = "+"
End If
If p(a) > p(b) And a > b Then
If p(z(1)) - n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)) + 10, min(z(1), z(2))) = "+"
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)) + 10, min(z(1), z(2))) = "-": s = s + 1
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)) + 10, min(z(2), z(3))) = "+"
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)) + 10, min(z(2), z(3))) = "-": s = s + 1
If p(z(3)) - n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(max(z(3), z(4)) + 10, min(z(3), z(4))) = "+"
If p(z(3)) + n(z(3), z(4)) = p(z(4)) Then Worksheets("Лист3").Cells(max(z(3), z(4)) + 10, min(z(3), z(4))) = "-": s = s + 1
If p(z(4)) - n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(max(z(4), z(5)) + 10, min(z(4), z(5))) = "+"
If p(z(4)) + n(z(4), z(5)) = p(z(5)) Then Worksheets("Лист3").Cells(max(z(4), z(5)) + 10, min(z(4), z(5))) = "-": s = s + 1
End If
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
w(i, j) = Worksheets("Лист3").Cells(i + 10, j)
Next j
Next i
If s = 1 Then
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
If w(i, j) = "-" Then l = postavka(i, j): k = i: r = j: Exit For
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
If w(i, j) = "-" Then postavka(i, j) = postavka(i, j) - l
If w(i, j) = "+" Then postavka(i, j) = postavka(i, j) + l
Next j
Next i
For i = 1 To 7 Step 1
For j = 1 To 7 Step 1
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.