+ Reply to Thread
Results 1 to 3 of 3

how do I transpose data?

  1. #1
    Registered User
    Join Date
    04-26-2016
    Location
    singapore
    MS-Off Ver
    Office xp
    Posts
    20

    how do I transpose data?

    Hello everyone, I having run time error 9 when I tried to transpose data into an array. I want to transpose data from "F3" to "K3" into data1(), during debugging it says that data1() subscript is out of range. Please help me transpose the data. And how does the transpose works?

    Please Login or Register  to view this content.
    Here is my code:

    Please Login or Register  to view this content.
    Last edited by Bronx; 05-12-2016 at 08:54 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2404
    Posts
    24,758

    Re: how do I transpose data?

    Here are some issues:

    • The array data1 has never been dimensioned so you can't assign anything to it. Also in your assignment you can't use empty parentheses.
    • You have declared your variables but you have allowed them all to default to Variant. It is a better practice to declare them as specific data types.
    • Your argument to Evaluate is a bit confusing because you are using two nested Transpose functions. That just transposes them once and then transposes them back to where you started.
    • If multiple checkboxes are checked then you are copying data into the same array over and over again. If you are requiring that only one of them can be checked, then I recommend using option buttons instead of checkboxes.


    You want this. Declaring data1 as a Variant instead of a Variant array allows the dimensions to be set automatically when you do the assignment. After this assignment you can treat data1 as though it had been declared as an array with dimensions (1 To 1, 1 To 6). You don't need any of that Transpose jazz.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    04-26-2016
    Location
    singapore
    MS-Off Ver
    Office xp
    Posts
    20

    Re: how do I transpose data?

    Sorry if I misunderstood what you meant.


    treat data1 as though it had been declared as an array with dimensions (1 To 1, 1 To 6)
    I changed my code as below but there is error runtime 13 type mismatch if I do this.
    Please Login or Register  to view this content.

    if it is changed to
    Please Login or Register  to view this content.
    It shows that data1 is empty.

    I wanted to use array as there are some blank cells, so I can truncate only the data1 array with data into the body1 variable. Transpose is the only way I know of to store the data into an array.
    Last edited by Bronx; 05-13-2016 at 02:07 AM.

+ 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. transpose column to a range calculate and transpose to new table loop
    By moshro1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-02-2015, 10:52 AM
  2. Replies: 7
    Last Post: 10-03-2014, 05:04 AM
  3. Transpose Data from Columns to Rows after each unique data point
    By lnagell in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-01-2014, 08:10 PM
  4. Transpose data to columns from rows keeping unique data together
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-09-2013, 12:23 AM
  5. Transpose horizontal data to vertical data with paste link
    By M.Devadhasan in forum Excel General
    Replies: 0
    Last Post: 07-07-2012, 01:01 PM
  6. [SOLVED] Transpose: How can I copy a list and transpose it but leaving 3 cells in between each item
    By cocolete in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-11-2012, 10:01 AM
  7. Replies: 2
    Last Post: 02-19-2007, 04:53 PM

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