Option Explicit
Sub laba9()
Dim N As Integer, a() As Integer, i As Byte, j As Byte, min As Integer, l1 As Integer, l2 As Integer
Dim b() As Integer
N = Val(InputBox("Введите размерность массива"))
ReDim a(N, N)
Sheets("Лист1").Select
Sheets("Лист1").Range("A1:Z26").Clear
For i = 1 To N
For j = 1 To N
a(i, j) = Rnd * 100
Cells(i, j) = a(i, j)
Next j
Next i
min = a(1, 1)
l1 = 1
l2 = 2
For i = 1 To N
For j = 1 To N
If a(i, j) < min Then
min = a(i, j)
l1 = i
l2 = j
End If
Next j
Next i
ReDim b(N - 1, N - 1)
For i = 1 To l1 - 1
For j = 1 To l2 - 1
b(i, j) = a(i, j)
Next j
For j = l2 + 1 To N
b(i, j - 1) = a(i, j)
Next j
Next i
For i = l1 + 1 To N
For j = 1 To l2 - 1
b(i - 1, j) = a(i, j)
Next j
For j = l2 + 1 To N
b(i - 1, j - 1) = a(i, j)
Next j
Next i
For i = 1 To N - 1
For j = 1 To N - 1
Cells(i + N + 2, j) = b(i, j)
Next j
Next i
End Sub