"Object Required" error when using Collections

  • Re: "Object Required" error when using Collections


    BuyUniqueSole does not exist in your code, it is BuyUnique... If you had used Option Explicit, the VBE editor would have raised a message when trying to run the code.

    Regards,


    Wigi


    Excel MVP 2011-2014


    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes


    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

  • Re: "Object Required" error when using Collections


    You're right , that's a second mistake.
    But actually the error caused by single "New Collection" for few collections.
    Once I changed from:

    Code
    Dim BuyUniqueZero, BuyUniqueSole As New Collection


    to

    Code
    Dim BuyUniqueZero As New Collection
        Dim BuyUniqueSole As New Collection


    It solved!

  • Re: "Object Required" error when using Collections


    jonny,


    Perhaps you uploaded a different version of the spreadsheet to the one you intended. The code

    Code
    Dim BuyUniqueZero, BuyUniqueSole As New Collection

    doesn't exist in the workbook I downloaded. There is no reference to 'BuyUniqueZero' anywhere.


    I assume that you are now aware that the declaration of each variable must be followed by 'As variable type', otherwise it will take the default type of Variant.

    [COLOR="Purple"]Regards,[/COLOR]
    [COLOR="Purple"]Batman.[/COLOR]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!