+ Reply to Thread
Results 1 to 2 of 2

Looping through 2D array prints the same value issue

  1. #1
    Registered User
    Join Date
    08-15-2016
    Location
    Prague, CZH
    MS-Off Ver
    2016
    Posts
    1

    Looping through 2D array prints the same value issue

    I'm writing this VBA code that loops through a defined range and finds the filled cells within in, then it refers 5 different indexes to each cell, and to check if each cell is truly indexed with these values, I write my array to a worksheet.
    I can manage the loop to work and print exactly the number of filled cells - but the problem is that it prints out the same exact value for each cell even though they are totally different.

    Here is how my worksheet looks like:
    \1

    And what it prints out is:

    \1

    Using this code:

    Please Login or Register  to view this content.
    As you can see, even though the code loops through the entire range - only the last cell, Cells(6,8) is printed with its indexes.
    NOTE: I can only do it using a 2D array of number of molecules x 5 indexes (uni project) so please do not try to change it, I just need to understand the problem of why I am only printing out one value for all cells.

    I'd appreciate any help.

  2. #2
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    861

    Re: Looping through 2D array prints the same value issue

    Hi there
    Please upload a dummy worksheet with a before and after worksheet.
    Nobody wants to work from a picture. (or two)
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

+ 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. [SOLVED] Looping thru arrays with dynamic names. Array1/2/3/5, how to array(Array & i) syntax?
    By graym463 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-24-2015, 10:15 AM
  2. Odd macro looping issue
    By mattmickle in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-28-2015, 04:16 PM
  3. Array looping, increase speed of array macro
    By techrcn in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-27-2013, 05:33 AM
  4. Looping issue
    By wani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-30-2012, 02:23 AM
  5. VBA. Syntax issue. Looping array
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2012, 10:17 AM
  6. Need help with looping issue
    By SDBoca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2011, 08:18 PM
  7. Looping issue
    By davidm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2005, 01:58 PM

Tags for this Thread

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