I currently have two arrays each of which contain ranges. How would you go about getting the intersection of these two arrays. In other words, I would like to get an array of ranges that only contains the ranges that are contained in both of the two original arrays. I tried .Intersect but that does not work on arrays as I learned.
array1: (Range("A1"),Range("B1"),Range("C1")) array2: (Range("A1"),Range("A2"), Range("A3"))
Result: (Range("A1"))
you can use this code. The idea is to merge your array in a single range using an iterative
Union
. Then you can use the built-inIntersect
.