Private Sub CommandButton1_Click() Dim s() As Integer, n As Integer, m As Integer Dim i As Integer, j As Integer Dim min As Integer, max As Integer, q As Integer, w As Integer Cells.Clear n = InputBox("CTROKI", , 4) m = InputBox("CTOLBEC", , 5) Randomize ReDim s(n, m) As Integer For i = 1 To n max = -100: min = 100 For j = 1 To m s(i, j) = Int(Rnd() * 60 - 10) Cells(i, j) = s(i, j) Cells(i + 2 + n, j) = s(i, j) If min > s(i, j) Then min = s(i, j) q = j End If If max < s(i, j) Then max = s(i, j) w = j End If Next j Cells(i + 2 + n, w) = min Cells(i + 2 + n, q) = max Next iEnd Sub