Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 23 of 23

Thread: Compile error: Variable not defined

  1. #21
    Huh, there is one more issue (again).

    I need to update a SumXCollection member, with a new value of one of its properties (TotalXX):

    [vba]Public SumXCollection As Collection
    Public zx As SumX
    Public begin1 As Integer
    Public article As String
    ...
    Dim i As Integer

    For i=0 To ...
    ...

    Set zx = SumXCollection(article & Color.Text)
    zx.TotalXX = ActiveSheet.Cells(begin1 + i, 11) 'begin1 and 'article' are set in previous procedure
    SumXCollection(article & Color.Text) = zx ' THIS LINE YELLOW MARKED
    ...

    Next i[/vba] getting:
    Run-time error '438':
    Object doesn't support this property or method
    What to do now?


    edit:

    SumX Class[vba]Option Explicit

    Private pKeyXX As String
    Private pCodeXX As String
    Private pColorXX As String
    Private pTotalXX As String

    Public Property Get KeyXX() As String
    KeyXX = pKeyXX
    End Property

    Public Property Let KeyXX(ByVal vNewValue As String)
    pKeyXX = vNewValue
    End Property

    Public Property Get CodeXX() As String
    CodeXX = pCodeXX
    End Property

    Public Property Let CodeXX(ByVal vNewValue As String)
    pCodeXX = vNewValue
    End Property

    Public Property Get ColorXX() As String
    ColorXX = pColorXX
    End Property

    Public Property Let ColorXX(ByVal vNewValue As String)
    pColorXX = vNewValue
    End Property

    Public Property Get TotalXX() As String
    TotalXX = pTotalXX
    End Property

    Public Property Let TotalXX(ByVal vNewValue As String)
    pTotalXX = vNewValue
    End Property[/vba]
    Last edited by SMC; 02-04-2007 at 03:55 PM.

  2. #22
    Hi

    wouldn't it be a matter of updating that item in the collection?

    [vba]
    SumXCollection(article & Color.Text).TotalXX = ActiveSheet.Cells(begin1 + i, 11)
    [/vba]

    Tony

  3. #23

    Thumbs up

    Yep. Thanks.

    I'm coming back soon with one (or two) more question(s).


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •