Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88030

Is it possible to extend the length of an existing array based on values collected from other arrays?

$
0
0

Let's say I have a couple arrays such as:

array(0) = (a, b, d, e)
array(1) = (c, e, g)
array(2) = (a, c, f, g, h)

Which all have some values in common.

I want to extend the length of these arrays to look like:

(a, b, , d, e, , , )
( , , c, , e, , g, )
(a, , c, , , f, , h)

Basically, I want to make sure all arrays are the same length and that the values will align across each element.

How can I do this with vba code?

I was thinking I would create a collection that stores unique values and ReDimension the existing arrays or create new arrays to mirror the existing one based on the length of the collection. But I don't know how to move the array elements accordingly.

Thanks!


Viewing all articles
Browse latest Browse all 88030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>