ReDim Preserve - Subscript Out of Range

• Dear Team,

Please assist me in resolving the Subscript Out of range in Dynamic Range when Reclaiming Row .

i just store first value and at second getting error.

Code
``            ReDim Preserve da(d, 4)``

Thanks

• If you use Preserve you can only resize the upper bound of the last dimension.

Rory
Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

• Thank you, sir. Would you please elaborate on the code.

• You haven't indicated what you are actually doing with the arrays you create (your posted code is pointless), which makes it difficult to be sure what the best option is, but generally you would transpose the ca and da arrays while working with them - for example:

Code
``````ReDim Preserve ca(4, c)
ca(1, c) = Abs(a(i, 4))
ca(2, c) = a(i, 2)
ca(3, c) = a(i, 1)
ca(4, c) = a(i, 9)``````

Rory
Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!