Hello
I have been trying to copy an array to a range, I can do it when the array is just a standard array such as
Dim Arr(1 to 10, 1 to 5) as Variant
Dim Rng as Range
Set Rng = ActiveSheet.Range("A1:E10")
Rng = Arr
However what I would like to do is..
Type Product
Code As String
Description As String
Cost As Currency
Qty As Integer
Retail As Currency
End Type
Sub Test()
Dim Arr(1 To 10) As Product
Dim Rng As Range
Set Rng = ActiveSheet.Range("A1:E10")
Rng = Arr
End Sub
However this produces an error of "Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions.
Can someone please shed some light to weather it is possible to do what I want?
I read some where that the Type needs to be a class, but could not get that to work either