Results 1 to 4 of 4

Iterate over two index variables to reorder an array

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    108

    Iterate over two index variables to reorder an array

    Hi,

    I have to reorder my array and paste it to a sheet. I am trying to do this with a for loop that iterates over two index variables.

    Sub example()
    
    Dim MyArray() As Variant
    Dim FirstElement As Range
    Dim i As Integer
    Dim j As Integer
    
    
    Set FirstElement = Range("J1")
    MyArray = Range(Cells(2, 2), Cells(17, 2)).Value
    
    For i = 1 To 16
        For j = 1 To 16 Step 2
            FirstElement.Offset(j, 0).Value = MyArray(i, 1)
        Next j
    Next i
    
    
    End Sub
    But I dont get it to work. I have attached example of my array. That better explains what I am trying to accomplish.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 01-27-2016, 11:19 AM
  2. Replies: 5
    Last Post: 12-02-2015, 05:23 AM
  3. Iterate through Worksheets Building an Array
    By MaterialMaster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2014, 04:34 PM
  4. [SOLVED] Iterate Array Names with Integers
    By AlvaroSiza in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2014, 10:32 AM
  5. [SOLVED] finding an output from 5 variables in an array using exterior input user variables
    By Allsort in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-09-2013, 11:16 AM
  6. Reorder - Array
    By -EE- in forum Excel General
    Replies: 1
    Last Post: 01-08-2012, 01:57 AM
  7. How can I randomly reorder my values in my array?
    By shapper in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2008, 05:24 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