Skip to content

Instantly share code, notes, and snippets.

@stephanecoinon
Created December 11, 2013 20:47
Show Gist options
  • Save stephanecoinon/7918179 to your computer and use it in GitHub Desktop.
Save stephanecoinon/7918179 to your computer and use it in GitHub Desktop.
VBA converts a collection to array
' Source: http://www.iwebthereforeiam.com/iwebthereforeiam/2004/06/excel-vba-code-to-convert-coll.html
Function collectionToArray(c As Collection) As Variant()
Dim a() As Variant: ReDim a(0 To c.Count - 1)
Dim i As Integer
For i = 1 To c.Count
a(i - 1) = c.Item(i)
Next
collectionToArray = a
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment