+ Reply to Thread
Results 1 to 5 of 5

Invalid Qualifier

  1. #1
    Registered User
    Join Date
    04-03-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    3

    Invalid Qualifier

    Hi! I've just started using vba, I've to solve a problem as soon as possible so I can't spend a lot of time studing...
    When I compile the code below, I have an "Invalid qualifier" error at "arr.lenght". Someone could help me?
    Thanks a lot,


    Luca


    Please Login or Register  to view this content.
    Last edited by arlu1201; 04-03-2012 at 07:41 AM. Reason: Put code tags for you. Please do so in future.

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Invalid Qualifier

    Hello, and welcome to the forum.

    Bad things first - can you please read the forum rules and use code tags around any code you post.

    On to the problem - what are you trying to do with the .length property? The variable arr isn't an object, but an array. If you want to know how many elements there are in the array and loop through them then what you need is:

    Please Login or Register  to view this content.
    Hope this helps.

  3. #3
    Registered User
    Join Date
    04-03-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Invalid Qualifier

    Many thanks,
    I'm sorry for the code tags, I'll read the rules before posting another code.

    I've ament the code with your suggestion, but unfortunately it doesn't work. Now I have a "Run-time error: 1004. Application defined or object-defined error." on "Cells(i + 12, zeta) = arr(zeta)".
    I would loop through the elements in a single row before going on next column.
    Thanks in advance.

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Invalid Qualifier

    After I posted I realised that would be your next problem and meant to warn you about it.

    The issue is that, by default, Excel arrays run from element 0, not element 1.

    The quick and dirty way to fix this is, right at the start of your code - even before the "Private Sub" line put:

    Please Login or Register  to view this content.
    This is fairly sloppy programming practice, but will work just fine in this case.

    The 'proper' way of doing it would be something like:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-03-2012
    Location
    Italy
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Invalid Qualifier

    Now it works, many many thanks!!!!

    Luca

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1