Sub ()Dim A(1 To 4, 1 To 4) As IntegerDim B(1 To 3, 1 To 3) As IntegerRandomizeFor i = 1 To 4 For j = 1 To 4 A(i, j) = Int((10 * Rnd) + 1) Cells(i, j) = A(i, j) Next jNext iFor i = 1 To 3 For j = 1 To 3 B(i, j) = Int((10 * Rnd) + 1) Cells(i + 5, j) = B(i, j) Next jNext iCall ObrabotkaA(A)Call ObrabotkaB(B)Call Result(A, B)End SubSub ObrabotkaA(A)CollumnMax = 0CollumnMin = 0SummMax = 0SummMin = 999For j = 1 To 4Summ = 0 For i = 1 To 4 Summ = Summ + A(i, j) Next i If Summ > SummMax Then SummMax = Summ CollumnMax = j End If If Summ < SummMin Then SummMin = Summ CollumnMin = j End IfNext jFor i = 1 To 4 Temp = A(i, CollumnMax) A(i, CollumnMax) = A(i, CollumnMin) A(i, CollumnMin) = TempNext iEnd SubSub ObrabotkaB(B)CollumnMax = 0CollumnMin = 0SummMax = 0SummMin = 999For j = 1 To 3Summ = 0 For i = 1 To 3 Summ = Summ + B(i, j) Next i If Summ > SummMax Then SummMax = Summ CollumnMax = j End If If Summ < SummMin Then SummMin = Summ CollumnMin = j End IfNext jFor i = 1 To 3 Temp = B(i, CollumnMax) B(i, CollumnMax) = B(i, CollumnMin) B(i, CollumnMin) = TempNext iEnd SubSub Result(A, B)For i = 1 To 4 For j = 1 To 4 Cells(i, j + 5) = A(i, j) Next jNext iFor i = 1 To 3 For j = 1 To 3 Cells(i + 5, j + 5) = B(i, j) Next jNext iEnd Sub