1

I want to create an array storing arrays which stores 4 pieces of information. For example, region "0" is bound by 4 lines, x=1, x=2, y=3, y=4. I want to store the array like this " array[0]=(1,2,3,4)" Similarly, region "1" is bound by x=3, x= 6, y=2, y=3. I want to store the array like this "array[1]=(3,6,2,3)". I have tried to learn about jagged array. But I dont know how to apply it to my case.

5
  • What your looking for are multidimensional arrays, if you google "multi dimensional array vba" you get tons of informations. Here is one link: techotopia.com/index.php/Visual_Basic_Multidimensional_Arrays Commented Oct 9, 2017 at 13:10
  • @Doomenik Jagged arrays also apply. Commented Oct 9, 2017 at 13:12
  • My favorite VBA resource:Excel VBA Introduction Part 25 - Arrays Commented Oct 9, 2017 at 13:12
  • @Doomenik Generally I don't like them as you can only ReDim last dimension. Commented Oct 9, 2017 at 13:17
  • thanks, I have used multidimensional arrays to solve my problems! Commented Oct 9, 2017 at 13:24

1 Answer 1

1
data=Array(Array(1,2,3,4), Array(3,6,2,3), ...) 'This is your data
For region = 0 To 1
    debug.print "Region " & region & ":"
    debug.print "x=";data(region)(0)
    debug.print "x=";data(region)(1)
    debug.print "y";data(region)(2)
    debug.print "y=";data(region)(3)
Next
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.