title: Sort 2D array in Excel VBA
body: <p>Good day,</p>
  
  <p>I am trying to sort a 2D array, based on the contents of the first column. I found this code for "QuickSortArray" which seem to be the solution:</p>
  
  <p><a href="https://stackoverflow.com/questions/4873182/sorting-a-multidimensionnal-array-in-vba">Sorting a multidimensionnal array in VBA</a></p>
  
  <p>Although I can't make it work for my example. My example is:</p>
  
  <pre><code>Sub test()
  
  Dim TestArray1(1 To 4, 0 To 1) As Variant
  Dim TestArray2
  
  TestArray1(1, 0) = 108
  TestArray1(2, 0) = 109
  TestArray1(3, 0) = 106
  TestArray1(4, 0) = 110
  
  TestArray1(1, 1) = 10
  TestArray1(2, 1) = 5
  TestArray1(3, 1) = 15
  TestArray1(4, 1) = 2
  
  TestArray2 = QuickSortArray(TestArray1, , , 2)
  
  Debug.Print TestArray2(2, 1)
  
  End Sub
  </code></pre>
  
  <p>I try to sort the array, based on the first or second column.</p>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>expecting function or variable.</p>
  </blockquote>
  
  <p>Do you know what is wrong with my example?</p>