1 2 4 7 10
3 5 8 11 13
6 9 12 14 15
Sub new1()
Dim n As Long, m As Long, k As Long
n = InputBox("число строк", , 3)
m = InputBox("число столбцов", , 5)
ReDim a(1 To n, 1 To m) As Long
On Error GoTo 1
For m = 1 To m + n - 1
For n = 1 To UBound(a)
k = k + 1
a(n, m - n + 1) = k
2 Next
Next
'вывод массива
For n = 1 To UBound(a)
For m = 1 To UBound(a, 2)
Print a(n, m); " ";
Next
Print
Next
Exit Sub
1 k = k - 1
Resume 2
End Sub
Тестирование выполнено в программе QB64 ( Скачать )