+ Reply to Thread
Results 1 to 15 of 15

array printing problems - transpose

  1. #1
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    array printing problems - transpose

    Hi,

    I'm looping through some code building up a 1D array, which when 'full' (5000 elements) is sent to a function to determine which worksheet to paste it into and to then paste it.

    My question is, is there any reason why this code should work
    Please Login or Register  to view this content.
    But this fails
    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    I'd do it like this:
    Please Login or Register  to view this content.
    Last edited by shg; 04-12-2010 at 01:58 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    Thanks, I tried your code, but it still kept falling over at

    Please Login or Register  to view this content.
    are there any limitations with the transpose function, such as length of string in each element, or length of array?

    Thanks again

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    Probably, but not at 5000 elements. What's the error?

  5. #5
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    runtime error '13':

    Type mismatch
    I've tried several different tweaks to the code in the opening post, but keep getting this error.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    Post the rest of the code.

  7. #7
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    Please Login or Register  to view this content.
    I use very similar code with another array and it works well. The only thing I can think of is that the strings in each element of the array are long. But then printing each string individually works fine.

    Thanks for your time

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    How long?

    Write some test cases. Shorten the array to fewer elements, and see if that works.

  9. #9
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    Each element in the array will have around 200 comma seperated numbers.

    I was wondering if this could be the problem (I seem to remember reading somewhere that each cell can only contain upto 250 characters) , but if I print each array element individually (code block one in my original post) it seems to work fine.

    An example of the numbers being held are
    60022, -0.001155, -0.002319, -0.003608, -0.004936, -0.006211, -0.007348, -0.008275

    I've tried reducing the maximum number of elements in the array, but still not working.

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    Cells can contain up to 32K characters, or which the first ~1K will display.

    I may be (probably am) missing something simple. Can you post the most skinnied-down workbook possible that illustrates the problem?

  11. #11
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    I've kept the function I'm having issues with as authentic as possible in case I am doing somethig stupid, and trimmed everything else as much as I could (It turns out that's quite difficult)

    Many thanks
    Attached Files Attached Files

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    OK, I can't look at this now, but will by and by if no one else sorts it out first.

  13. #13
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    That's appreciated. Many thanks.

    Jane

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: array printing problems - transpose

    You can only output 255 characters per array value in that fashion, which I checked like this:
    Please Login or Register  to view this content.
    Got a plan B?

    For one thing, you could use Split to separate each line of the data at the commas, then you wouldn't need the text to columns afterward.

  15. #15
    Forum Contributor
    Join Date
    03-19-2010
    Location
    Calgary, Canada
    MS-Off Ver
    Office 2013, Office 365 Pro Plus
    Posts
    182

    Re: array printing problems - transpose

    Dang!!

    Well thankyou for your time, I'll have to have a think.
    Last edited by shg; 04-14-2010 at 01:59 PM.

+ 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