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