+ Reply to Thread
Results 1 to 13 of 13

VBA How to Transpose Rows to Column

  1. #1
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    VBA How to Transpose Rows to Column

    Hi!

    I need to help with vba code or formula for transpose data from Rows to one Column.

    In sheet1 I have 350 rows (each row have 8 columns).

    In sheet2 I want transpose this data to one column (in column will 2800 data = 2800 rows).

    Example:example.png

    That means I need to change the data dynamically.

    I tried to use transpose matrix, index, etc. but it did not work right for me.

    Thank you in advance for your help.

    --Daniel

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: VBA How to Transpose Rows to Column

    =INDEX(Sheet1!$B$2:$B$6,1+INT((ROWS($1:1)-1)/8))
    copied down...

    and
    =INDEX(Sheet1!$C$2:$J$6,1+INT((ROWS($1:1)-1)/8),1+MOD((ROWS($1:1)-1),8))
    copied down.

    Adjust the ranges to suit, as we could not tell what cells your data were in. Also, being Czech, you will probably need ; instead of , as a separator.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,525

    Re: VBA How to Transpose Rows to Column

    Sub voda4444()
    If code is required, you might try something like this.
    Please Login or Register  to view this content.
    Works on data as per your example picture.

  4. #4
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: VBA How to Transpose Rows to Column

    Thank you Glenn Kennedy, that works perfect.

    I still want to ask for help with this... In your Attached File Book1.xlsx...

    From sheet1 I want to use data from columns D, G, I, J.

    In sheet2 want output see attached png below.

    Example:
    example2.png

    Book1.xlsx

    Formula what I tried is like this

    =CONCATENATE("CELL[";INDEX(Sheet1!$B$2:$B$6,1+INT((ROWS($1:1)-1)/8));"].BASE.X := ";INDEX(Sheet1!$C$2:$J$6,1+INT((ROWS($1:1)-1)/8),1+MOD((ROWS($1:1)-1),8));";")

    I dont know how to do it.

    Help me please.

    Thank you in advance.

    --Daniel
    Last edited by voda4444; 01-12-2018 at 05:17 PM.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: VBA How to Transpose Rows to Column

    Please attach a workbook, not a picture of one.

    Unfortunately the attachment icon doesn't work at the moment. So, to attach an Excel file you have to do the following: Just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA How to Transpose Rows to Column

    In the mean time here's a VBA solution.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: VBA How to Transpose Rows to Column

    voda444. I have't a clue what you are talking about. Start with a new file, showing before and after....

  8. #8
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: VBA How to Transpose Rows to Column

    Thank you bakerman2, your VBA code works perfect.

    My question about this code...

    Is it possible to change output data dynamicly (when I change something in Sheet1), change also occurs in a Sheet2 without manual Run macro.

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA How to Transpose Rows to Column

    Put this in Sheet Module of Sheet1.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: VBA How to Transpose Rows to Column

    Thank you

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA How to Transpose Rows to Column

    You're welcome and thanks for rep+.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  12. #12
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: VBA How to Transpose Rows to Column

    Hi!

    I need help with some adjustments of used VBA.

    There is a example - Book1.xlsx

    Thank you.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-09-2017
    Location
    Ostrava
    MS-Off Ver
    2016
    Posts
    36

    Re: VBA How to Transpose Rows to Column

    Quote Originally Posted by voda4444 View Post
    Hi!

    I need help with some adjustments of used VBA.

    There is a example - Attachment 556332

    Thank you.
    Solved...

    Please Login or Register  to view this content.
    Last edited by voda4444; 01-16-2018 at 12:17 PM.

+ 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 2 rows to column
    By rontabz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-16-2017, 11:37 AM
  2. Transpose 2 rows to column
    By rontabz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-16-2017, 09:19 AM
  3. Transpose every 5 cells in column A to indidual rows in column B
    By meridklt in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-14-2013, 12:35 AM
  4. Insert rows, transpose data from column in to rows, in steps
    By mchevalier in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2012, 08:14 PM
  5. transpose Rows to column
    By gcol in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-01-2011, 05:12 PM
  6. Transpose Column to Rows
    By hardeep.kanwar in forum Excel General
    Replies: 7
    Last Post: 03-29-2010, 05:57 AM
  7. Transpose rows to column
    By MaxBrit in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2005, 03:07 AM

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