If ((a = 2 And b = 6) Or (a = 6 And b = 2)) And p(2) > p(6) Then z(1) = 2: z(2) = 7: z(3) = 6
If ((a = 2 And b = 7) Or (a = 7 And b = 2)) And p(2) <= p(7) Then z(1) = 7: z(2) = 6: z(3) = 2
If ((a = 2 And b = 7) Or (a = 7 And b = 2)) And p(2) > p(7) Then z(1) = 2: z(2) = 6: z(3) = 7
If ((a = 6 And b = 7) Or (a = 7 And b = 6)) And p(6) <= p(7) Then z(1) = 7: z(2) = 2: z(3) = 6
If ((a = 6 And b = 7) Or (a = 7 And b = 6)) And p(6) > p(7) Then z(1) = 6: z(2) = 2: z(3) = 7
Worksheets("Лист3").Cells(min1(a, b), max1(a, b) + 8) = "+"
s = 0
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)), max(z(1), z(2)) + 8) = "-": s = s + 1
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(min(z(1), z(2)), max(z(1), z(2)) + 8) = "+"
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)), max(z(2), z(3)) + 8) = "-": s = s + 1
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)), max(z(2), z(3)) + 8) = "+"
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(min(z(1), z(2)), max(z(1), z(2)) + 8) = "+"
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(min(z(1), z(2)), max(z(1), z(2)) + 8) = "-": s = s + 1
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)), max(z(2), z(3)) + 8) = "+"
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(min(z(2), z(3)), max(z(2), z(3)) + 8) = "-": 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)), min(z(1), z(2)) + 8) = "-": s = s + 1
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)), min(z(1), z(2)) + 8) = "+"
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)), min(z(2), z(3)) + 8) = "-": s = s + 1
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)), min(z(2), z(3)) + 8) = "+"
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)), min(z(1), z(2)) + 8) = "+"
If p(z(1)) + n(z(1), z(2)) = p(z(2)) Then Worksheets("Лист3").Cells(max(z(1), z(2)), min(z(1), z(2)) + 8) = "-": s = s + 1
If p(z(2)) - n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)), min(z(2), z(3)) + 8) = "+"
If p(z(2)) + n(z(2), z(3)) = p(z(3)) Then Worksheets("Лист3").Cells(max(z(2), z(3)), min(z(2), z(3)) + 8) = "-": 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, j + 8)
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
Worksheets("Лист1").Cells(i + 15, j + 8) = postavka(i, j)
Next j
Next i
If a <= b Then
Worksheets("Лист1").Cells(k + 6, r + 8) = ".": Exit Sub
End If
If a > b Then
Worksheets("Лист1").Cells(r + 6, k + 8) = ".": Exit Sub
End If
End If
If s = 2 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
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.