I having trouble getting this to work. I just want to return an array from a function, the code i've tried is below.
Sub
Dim storeData As Variant: Set storeData = getData
Debug.Print storeData(1)
End Sub
Function getData() As Variant
Dim arr(2) As Variant
arr(1) = "ergreg"
arr(2) = "1005"
getData = arr
End Function
No errors are thrown but nothing is printed to the immediate window
Set
. – GSergDebug.Print storeData(1)
will only print the 2nd of the 3 elements in your array) – Shai Rado