Answers for "vba array to collection"

VBA
0

vba array to collection

' Converts an array to a collection
Function ArrayToCollection(pArray As Variant) As Collection
    Set ArrayToCollection = New Collection
    Dim item As Variant
    For Each item In pArray
        ArrayToCollection.add item
    Next item
End Function
' Adds a whole array to provided collection
Sub AddArrayToCollection(ByRef pCollection As Collection, pArray As Variant)
    Dim item As Variant
    For Each item In pArray
        pCollection.add item
    Next item
End Sub
Posted by: Guest on February-13-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language