Results 1 to 4 of 4

Variable Length Array does not bring correct data

Threaded View

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

    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
    Sub Test()
    Dim r As Integer
    Dim c As Integer
    
    r = Application.WorksheetFunction.CountIf(Range("A1", Range("A1").End(xlDown)), Cells(1, 10))
    c = Range("A1", Range("A1").End(xlToRight)).Columns.Count
    
    
    ReDim temparray(1 To r, 1 To c)
    
    For ar = 1 To r
        For ac = 1 To c
            For i = 1 To Range("A5", Range("A5").End(xlDown)).Rows.Count
                If Cells(1, 10) = Cells(i, 1) Then
                    temparray(ar, ac) = Cells(i, ac)
                End If
            Next i
        Next ac
    Next ar
    
    Range(Cells(1, 6), Cells(r, 5 + c)) = temparray
    
    End Sub
    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 *

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