vba function return matrix code example
Example: vba function return array
' Function returning an array
Function ReturnsArray() As String()
Dim returnValues(0 To 1) As String
returnValues(0) = "a"
returnValues(1) = "b"
ReturnsArray = returnValues
End Function
' ----------------------------------------
Sub TestMe()
Dim myArray() As String
myArray = ReturnsArray()
Debug.Print myArray(1) ' b
End Sub