-1

When stepping through code in Developer mode in Excel I see an array in VBA like so:

arrData(x)(y,z)

Is this a 2-dimensional array (the (y,z) part) stored inside an array (the (x) part)?

How do I access a particular element within the array and test if the value equals something I'm interested in?

If arrData(1)(2,3) = "orange" Then
End If

My above code yields Run-time error '9': Subscript out of range. The max value of x and y is 1, and the max value of z is 100.

MrPatterns
  • 4,184
  • 27
  • 65
  • 85

1 Answers1

0

This is called a jagged array. Essentially it is an array inside an array. These can be implemented in VBA (as you discovered) and can be called just like a regular array.

This answer here on SO explains it nicely.

Community
  • 1
  • 1
rohrl77
  • 3,277
  • 11
  • 47
  • 73