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
Question
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?
Solution
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