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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,344
Office Version
  1. 365
Platform
  1. Windows
Gareth

You can only redimension the last dimension of a multidimensional array.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,998
Messages
5,834,802
Members
430,322
Latest member
excelnoobnoob

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
Top