I have trouble accessing the values stored in a multi dimension Variant. Here is my code :
Sub test()
Dim vari() As Variant
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets(1)
ReDim vari(33, 5)
vari = ws.UsedRange.Value
vari = WorksheetFunction.Transpose(vari())
WorksheetFunction.Average(vari(1))
End Sub
here is my file: excel table
When I run this code I get error on the last line telling me "the index does not belong to the selection".
But the vari(1) seems to be something in the spy section. spy section
I know I could directly compute the average using the Range object in which the value are stored in this particular case. I simplified the situation for th purpose of this post but in my project I have multiple workbooks and subs and it is easier for me to use a Variant to store the values.
Any help would be very much appreciated