Answers for "return array vba"

VBA
1

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
Posted by: Guest on January-30-2021
0

returns an array from function vba

Function arrayOfPiDigits() As Long()

	'Add parenthesis after the data type
    Dim outputArray(0 To 2) As Long
    
    outputArray(0) = 3
    outputArray(1) = 1
    outputArray(2) = 4

    arrayOfPiDigits = outputArray
    
End Function
Posted by: Guest on September-25-2020

Code answers related to "VBA"

Browse Popular Code Answers by Language