Two dimensional array with run time error
I have tried to run the VBA, but there was a run time error "subscript out of range"
k(0) = 5
k(1) = 6
k(2) = 7
k(3) = 5
l(0) = 8
l(1) = 9
l(2) = 5
l(3) = 6
Do
For j = 0 To 3
ReDim feasible(k(4), 4)
For i = 0 To k(j) - 1
feasible(i, j) = Sheet1.Cells(3, 2 + j ) + i * (1 / 24) (subscript out of range)
Next
Next
For j = 0 To 3
ReDim lunch(l(4), k(4), 4)
For z = 0 To k(j) - 1
For y = 0 To l(j) - 1
lunch(y, z, j) = feasible(z, j) + Sheet1.Cells(5, 2 + j) + y * (1 / 24)
Next
Next
Next
j = j + 1
Loop Until j = 4
I would like to ask how can I run this coding appropriately
|