A collection cannot be written directly to a work sheet.
This code will take the elements of a collection and write them to a sheet. (Usually a collection holds objects, not values.)
Dim i As Long
Dim myArray as Variant
With Sheet1.Range("A1").Resize(myCollection.Count, 1)
Redim myArray(1 to .Rows.Count, 1 to .Columns.Count)
For i = 1 to myCollection.Count
myArray(i, 1) = myCollection(i)
Next i
.Value = myArray
End With
I'm curious about your collection. Frequently, collections hold objects, not variables, so writing them to a sheet involves a property of the items in the collection, not the item itself.
Also, there is no such thing as a 2D collection. All collections are one dimensional.
Bookmarks