My macro throws a type mismatch error when I use
Myarr= Application.Index(arr,0,1)
I have tried adding option explicit and defining the variables as variants but nothing seems to work.
The arr array is created from a CSV file and that contains 100000 rows and 11 columns.
The arr looks fine when I check it in the watch window (I can see the values for each row and column)
Here is the code:
Sub ArrTest()
Dim Myarr
Dim Arr
Dim wb As Workbook
Set wb = Workbooks.Open("F:\People.csv")
Arr = wb.Sheets(1).Range("A1").CurrentRegion.Value
Myarr = Application.Index(Arr, 0, 2)
End Sub
Can anyone suggest what I am doing wrong?