+ Reply to Thread
Results 1 to 4 of 4

Variable Length Array does not bring correct data

  1. #1
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Variable Length Array does not bring correct data

    Hi

    I want to create variable length array which should bring different data at each condition.

    My code is
    Please Login or Register  to view this content.
    But I could not understand at which part I did mistake, because code brings data only one of criteria. Please correct me. I want to understand the code.

    Thank you in advance
    Attached Files Attached Files
    Appreciate the help? CLICK *

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Variable Length Array does not bring correct data

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Valued Forum Contributor AZ-XL's Avatar
    Join Date
    03-22-2013
    Location
    Azerbaijan, Baku
    MS-Off Ver
    Excel 2007
    Posts
    603

    Re: Variable Length Array does not bring correct data

    Thank you very much.

    Can you tell me what was my mistake?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Variable Length Array does not bring correct data

    There were several mistakes.
    • Three nested loops when only two are needed (rows and columns)
    • You tested the criteria for every cell (all rows and all columns) when you only need to test the criteria for each row in the first column.
    • Your line For ar = 1 To r only looped through 4 rows as r was not the number of rows in your data. It was the count of the criteria match.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Bring scattered data to correct columns
    By vadaniels in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-22-2020, 10:32 PM
  2. Replies: 5
    Last Post: 06-18-2015, 09:10 AM
  3. Array Formula Lookup - Bring back Lowest Date + Bring Back Cell Location
    By Matt1998 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2014, 12:08 PM
  4. VBA variable length array help needed
    By Trinidad3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2010, 06:19 PM
  5. Passing arguments into function to bring data array from closed wb
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-08-2006, 10:55 AM
  6. [SOLVED] how do I do a variable length array based on the value in a cell
    By Mark Pranger in forum Excel General
    Replies: 1
    Last Post: 01-25-2006, 03:10 AM
  7. Graph with variable data length
    By snoach in forum Excel General
    Replies: 1
    Last Post: 05-27-2005, 05:15 AM

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