как можно разбить код, чтобы выделение диапазона ячеек происходило после ввода массива?
Код:
Sub m_1()
Dim myArray As Variant
Dim i As Long
Dim j As Long
Dim Max As Variant
Dim Min As Variant
Dim stl As Integer
Dim str As Integer
stl = InputBox("Введите количество столбцов")
str = InputBox("Введите количество строк")
For i = 1 To stl
For j = 1 To str
Sheets("Лист1").Cells(i, j) = InputBox("Введите" & j & "элемент" & i & "строки")
Next j
Next i
myArray = Selection
For i = 1 To UBound(myArray, 1)
Max = myArray(i, 1)
Min = myArray(i, 1)
For j = 1 To UBound(myArray, 2)
If myArray(i, j) > Max Then
Max = myArray(i, j)
ElseIf myArray(i, j) < Min Then
Min = myArray(i, j)
End If
Next j
Cells(i, 10).Value = "max" & " " & Max & " " & "min" & " " & Min
Next i
End Sub