Error: Object variable not set
In this code I have an issue passing an array between classes. So I have created a class called "Containers" with a class within "Containers" called "POs". To keep the code short, I'll just paste the parts that are affected:
Within the Container class:
Private pPOs() As PO
Public Property Get POs() As PO
Set POs = New POs
For C = 1 To UBound(POs)
POs(C) = pPOs(C)
Next C
End Property
Public Property Let POVar(Value As PO)
Set POVar = New PO
If POs(1).POName <> "" Then
ReDim Preserve pPOs(1 To UBound(pPOs) + 1)
End If
pPOs(UBound(pPOs)) = Value
End Property
--------------------------------------------------------------
Within the main code:
Range("A2").Select
For C = 1 To UBound(Tracker)
POs(C).POName = ActiveCell.Value <--------- Error happens here.
POs(C).Carrier = ActiveCell.Offset(0, 57).Value
POs(C).ProjInDCDate = ActiveCell.Offset(0, 52).Value
POs(C).Entity = ActiveCell.Offset(0, 8).Value
POs(C).Location = ActiveCell.Offset(0, 3).Value
POs(C).CaseCount = ActiveCell.Offset(0, 19).Value
POs(C).POWeight = ActiveCell.Offset(0, 67).Value
POs(C).POTrailer = ActiveCell.Offset(0, 62).Value
If ActiveCell.Offset(0, 62).Value <> " " Then
Containers = CheckContainerArray(Containers)
End If
Next C
---------------------------------------------------------------------
I believe the issue lies within the "setters and getters" portion of the code so the array isn't being populated correctly.
Any help or advice would be greatly apprecated.
FYI - I'm fairly new to coding... The one of my first projects and I'm self learning.
Thanks a million!!
-Likuid
Re: Error: Object variable not set
Have you created an instance of the class within the main code?