+ Reply to Thread
Results 1 to 12 of 12

Need a Transpose Macro

  1. #1
    Registered User
    Join Date
    03-31-2013
    Location
    NYC, USA
    MS-Off Ver
    Excel 2013
    Posts
    20

    Post Need a Transpose Macro

    Hey I was wondering if someone could help me with a transpose macro. I have a single column of data but it's about 1050 rows long, i need a macro that will put rows 1-20 right next to each other. So it would be something like this.

    Each X represents the 20 rows of data.

    X
    X
    X
    X
    X
    X
    X
    X
    X
    X
    X
    X
    X
    X


    i need
    X X X X X X X X X X X X X X


    Thanks in advance!
    Last edited by RA2925; 04-02-2013 at 01:48 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: Need a Transpose Macro

    Try something like this...

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Need a Transpose Macro

    RA2925,

    Welcome to the Excel Forum.

    I assume that your raw data is in worksheet Sheet1, beginning in cell A1 down.

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Registered User
    Join Date
    03-31-2013
    Location
    NYC, USA
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: Need a Transpose Macro

    Quote Originally Posted by AlphaFrog View Post
    Try something like this...

    Please Login or Register  to view this content.
    it almost worked! but it did not do it for all 1050 rows and it was pretty random for the data it did. Thanks! It was really helpful though!.

  5. #5
    Registered User
    Join Date
    03-31-2013
    Location
    NYC, USA
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: Need a Transpose Macro

    Quote Originally Posted by stanleydgromjr View Post
    RA2925,

    Welcome to the Excel Forum.

    I assume that your raw data is in worksheet Sheet1, beginning in cell A1 down.

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.

    Thanks for replying! I had a run time error with this saying that there was a type mismatch. I clicked debug and it highlighted this:
    Run_Time_Error.jpg


    Thank you very much for helping!

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Need a Transpose Macro

    RA2925,

    Please do not quote entire replies from your helper. When quoting follow these guidelines:
    1. Quote ONLY if it is needed to add clarity or context for your reply. If so, then
    2. Quote ONLY the specific part of the post that is relevant - - not the entire post.
    This will keep thread clutter to a minimum and make the discussion easier to follow.


    In order to get it right the next time:

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data scrubbed/removed/changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.

  7. #7
    Registered User
    Join Date
    03-31-2013
    Location
    NYC, USA
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: Need a Transpose Macro

    Thank you for letting me know. On this excel i have included 2 sheets. Sheet1 is how my data usually looks like and Sheet 2 is how i wwould like my data to look like. It is not always 1050 rows of data. My data is also just plain text. Thank you!


    sample data.xlsx

  8. #8
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: Need a Transpose Macro

    as an option
    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,835

    Re: Need a Transpose Macro

    Try this
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Need a Transpose Macro

    RA2925,

    Please do not quote entire replies from your helper. When quoting follow these guidelines:
    1. Quote ONLY if it is needed to add clarity or context for your reply. If so, then
    2. Quote ONLY the specific part of the post that is relevant - - not the entire post.
    This will keep thread clutter to a minimum and make the discussion easier to follow.


    My macro ReorgData worked correctly on your posted workbook in reply #7 ?????
    Last edited by stanleydgromjr; 04-02-2013 at 07:25 AM.

  11. #11
    Registered User
    Join Date
    03-31-2013
    Location
    NYC, USA
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: Need a Transpose Macro

    This worked great! Thank you!

  12. #12
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Need a Transpose Macro

    RA2925,

    Thanks for the feedback.

    You are very welcome. Glad we could help.

    Come back anytime.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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