Wrong number of argument or invalid property assignment collection adding

sumLosses is of type Collection therefore it is an object and has to be Set to another variable/function.

With using Set it should work:

Public Property Get getSumLosses() As Collection
    Set getSumLosses = sumLosses
End Property

Also defining the property As Collection might be no bad idea (but this didn't cause the error).


You need to declare Public Property Get getSumLosses() as a Collection and use Set :

Private sumLosses As Collection

Private Sub Class_Initialize() 
    Set sumLosses = New Collection
End Sub

Public Property Get getSumLosses() as Collection
    Set getSumLosses = sumLosses
End Property

:)

Tags:

Excel

Vba