Forum Discussion

NotSoFastEddie's avatar
NotSoFastEddie
Brass Contributor
Oct 07, 2024

Trouble with addressing a "jagged array" in Excel VBA - subscript out of range

I have been troubled with a subscript out of range issue.  At the very least I am looking to be able to address an array of arrays, apparently called a jagged array.

I have a simple example (chatGPT) that works wonderfully and when I look at the structure of arr_filteredData, the example matches my production array.  When I alter the simple example to pass down the arr_filteredData from the calling SUB, I end up receiving a subscript out of range error 9.

 

The one difference I noticed is that the sample starts at base 0 and the one I have is starting at base 1. and mine looks like arr_filteredData (1,1) and the sample looks like arr_filteredData(0)(0).  I think this is the primary issue.  How should I be addressing the production array?

Unfortunately, I can't supply data to go along with this example.  The code snippet is attached.

 

Alter the sample routine with the production array arr_filteredData

 

Resources