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