Dynamic multidimensional arrays - HELP!

G Unit

New Member
Joined
Dec 1, 2005
Messages
1
Is it possible to have a multidimensional dynamic array?
I'm new to VBA and can't get to grips with arrays as well as I would like.

I need to capture data from forms and at present I'm having to have seperate arrays for each item I want to capture.

I really want to be able to have the first element representing the event and then the child elements below holding the necessary info.

At present I'm doing something like this:

arrProd(x) = strProd
arrQty(x) = strQty
arrProdCde(x) = strProdCde

I would much rather have:

arrProd(x,1) = strProd
arrProd(x,2) = strQty

I can only find UBound as a function to give max length but whenever I try ReDim Preserve arrProd(maxLen +1, 3) I get an error.

I've tried variations on this and no joy. This is causing me to grey early!
Its upsetting me that I can do similar things to this in other languages but not with VBA.

Surely it is possible to do this? (or is it? and if not why the hell not!)

If some one can help I would more than grateful.

Thanks

Gareth
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Gareth

You can only redimension the last dimension of a multidimensional array.
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,284
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top