Answers for "vba array in functions"

VBA
6

vba array declaration

arrayData = Array("A", "B", "C", "D", "E")

[a1].Resize(UBound(arrayData)) = Application.Transpose(arrayData)
Posted by: Guest on March-25-2020
0

vba function array parameter

' Sample function with array parameter
Function processArr(Arr() As Variant) As String
    Dim N As Variant  
    dim finalStr as string      
    For N = LBound(Arr) To UBound(Arr)
        finalStr = finalStr & Arr(N)
    Next N
    processArr = finalStr
End Function
' ---------------------------------------------------------------
Sub TestMe()
    Dim fString As String
    Dim arr() As Variant
    arr = Array("foo", "bar")
    fString = processArr(arr)
End Sub
Posted by: Guest on January-30-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language