문제

Code below is giving me an Object doesn't support this property or method in HelperFunctions.updatecontractlist (PC)

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim PCName As String, BU, PC As Variant
    If Target.Address = "$B$1" Then
        PCName = Target.value
        For Each BU In TotalBook.GetBUs
            For Each PC In BU.GetPCs
                If PC.Name = PCName Then HelperFunctions.updatecontractlist (PC)
        Next PC, BU
    End If
End Sub

where updatecontractlist is:

Public Sub updatecontractlist(PC As Variant)

 whatever

End Sub

and PC is custom object what works fine in many other parts of the code and I can see, in my Watches window, that it's properly loaded when the bug happens.

what am I missing?

도움이 되었습니까?

해결책

You should change:

If PC.Name = PCName Then HelperFunctions.updatecontractlist (PC)

to

If PC.Name = PCName Then Call HelperFunctions.updatecontractlist (PC)

or

If PC.Name = PCName Then HelperFunctions.updatecontractlist PC

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top