0

Is there a better built-in solution for spliting a Nx2 array into 2 Nx1 arrays other than just looping through the original array and assigning array values one at a time? Ex: Something fancier than

Dim xvalues as Variant
Dim yvalues as Variant
ReDim xvalues(1 To UBound(arr2d))
ReDim yvalues(1 To UBound(arr2d))
For i=1 To UBound(arr2d)
    xvalues(i) = arr2d(i, 1)
    yvalues(i) = arr2d(i, 2)
Next i
  • 3
    Does this answer your question? [How do I slice an array in Excel VBA?](https://stackoverflow.com/questions/175170/how-do-i-slice-an-array-in-excel-vba) – omegastripes Sep 02 '20 at 05:29
  • @omegastripes Answers 99% my question. I'd just add that adding `.Value2` was needed in my case: `xvalues = Application.WorksheetFunction.Index(arr2d, 0, 1).Value2`, probably because `arr2d` was a `Range` and `xvalues` was not. – Oliver Mohr Bonometti Sep 02 '20 at 16:20

0 Answers0