+ Reply to Thread
Results 1 to 6 of 6

Output array to worksheet not working.....

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Output array to worksheet not working.....

    I have the following code:

    I also enclosed file with data and code as well.

    For some reason when i try to put the contents of the array into the worksheet it does not work.......i think i am doing it correctly.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Output array to worksheet not working.....

    because you redimension the array you have in fact made it 2 columns wide instead of 1 due to zero base arrays.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Output array to worksheet not working.....

    how on earth did you ever figure that out!!!!!!!!!!!!!

    How would i have seen / know that i changed the dimension of the array........

    I will make the array Option base 1.

    After i added the code "Option base 1" .......everything worked. I did not have to add your code......but i will try that as well.

    Also, in the future how can i debug my code better to have seen such a thing?

    thanks!

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: Output array to worksheet not working.....

    First thing I did was put something column G to see if the array was being outputted. Although the data in G was replace it was not with any data.

    So next I checked the array actual contained data, which I did. Then I use Lbound and UBound to see the size of the array and notices it as 2 across not 1.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Output array to worksheet not working.....

    Also try using your locals window, this is good for arrays as it's easy to see the dimensions and the data contained in them

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Output array to worksheet not working.....

    Also try to reduce the code:
    e.g.

    Please Login or Register  to view this content.
    Last edited by snb; 10-14-2011 at 10:27 AM.



+ 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