+ Reply to Thread
Results 1 to 7 of 7

Inputting the a transposed array

  1. #1
    Registered User
    Join Date
    07-27-2009
    Location
    L
    MS-Off Ver
    Excel 2003
    Posts
    19

    Inputting the a transposed array

    Hi there,

    when I try to read in data from my spreadsheet using the following code is works prefectly:
    Please Login or Register  to view this content.
    However when I try: which i simply trying to input a transposed version of the same data set I get the error:"run-time error '1004', "Application-defined or object-defined error". I changed the dimensions of the array to match the transposed form of the data vbeing read but still the bug remains!

    If I am going about this incorrectly what is the best way to read data arranged in rows into a program that expects them in column form ?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputting the a transposed array

    Presumably the 029 is a typo in your post and not your code (ie O29)... you don't specify how the two arrays are initialised...

    I confess I'm unsure as to the purpose of the loop, does the below not work for you ?

    Please Login or Register  to view this content.
    On an aside if the dimensions of the Arrays are to be determined by the Range (and not v-v) then you can leave the Arrays as variants and let the range set the size, eg:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-27-2009
    Location
    L
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Inputting the a transposed array

    That's great Thanks.

    I was perhaps a little unclear myself on what I needed.

    I want the data which is organised in rows on the spreadsheet to be passed to the VBA porgram in columns (the program I am accessing requires the data in columns)

    So reading it in as I was trying to do in my original code would onlyhave read it into VBA in rows instead of columns anyway.

    I managed to do it using the following:

    Please Login or Register  to view this content.
    There are 2500 rows being read in this manner, its pretty quick but there is a perceptible delay in getting a response maybe 0.2 of a second. If I could find awayto read the data in using the range.value method and perhaps transpose so you think I would get a significant performance increase?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputting the a transposed array

    You can Transpose the Data yes, again I'm still not sure I follow your own code but for ex. say I want A1:B26 into a 2 x 26 Array as opposed to 26 x 2 then

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-27-2009
    Location
    L
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Inputting the a transposed array

    OK that's great thank you.

    BTW when you say you don;t follow my code what are you referring to?

    Thanks

    Baz

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Inputting the a transposed array

    What I meant was... it would take a few moments for me to work through the logic of what you're doing in your code and given the fact that

    a) I'm pretty lazy

    and

    b) the question re: transposing of data could be answered irrespective of the code ...

    I didn't read through it , soz, no offence intended!

  7. #7
    Registered User
    Join Date
    07-27-2009
    Location
    L
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Inputting the a transposed array

    no worries.

    thanks for all your help it is most appreciated

+ 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