+ Reply to Thread
Results 1 to 9 of 9

Macro to transpose rows into columns and paste to specific columns in another sheet

  1. #1
    Registered User
    Join Date
    10-21-2018
    Location
    US
    MS-Off Ver
    Version 16.18
    Posts
    6

    Macro to transpose rows into columns and paste to specific columns in another sheet

    Hi, I would appreciate some help with creating a macro that will handle a couple of different variables including:
    • varying number of rows
    • varying row criteria
    • paste in specific columns in another sheet
    • keep collective order number information together during the transpose + column paste process (very important). The collective data is separated by varying number of empty rows. In the attached example, there are 4 collective data sets. Collective data sets will increase daily when form is refreshed
    • data that will be updated daily and in turn require ability to update macro as needed.

    Currently, I have a file (using queries & connections) that combines all of the data from files saved into a specific folder when I click on the "refresh all" option. This works well, but now I would like to transpose sets of data from rows into columns, and then have that pasted in another sheet according to specific columns.

    The data in C:D are what need to be manipulated. Because the data in columns f and g can be varying number of rows, the spacing between collective order numbers can also have varying number of empty rows.


    The file attached shows an example of what I currently have in sheet 1 and sheet 2 shows what I would like the macro to give me.

    On sheet 2, the columns needed are in row 1.
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    10-21-2018
    Location
    US
    MS-Off Ver
    Version 16.18
    Posts
    6

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    Thanks, but I get an error when running this macro:
    run-time error '1004':
    application-define or object-defined error

    Despite the error, it does manage to transpose the data on a second sheet but it is only transposing 1 of the 4 collective data sets and they're not in the specified columns. in the example shown, the "collective data" is c3:d16, c30:d43, c57:d77,and c91:d:112.

    the number of rows and quantity of collective data sets varies as the data is updated. if you notice, depending on the order and item number, certain criteria appear (1-5, A-L, or AA-MM).

    This is a bit confusing, but let me know if you need further clarification

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    The macro assumes the data starts on row 1. What row does your data start?

  5. #5
    Registered User
    Join Date
    10-21-2018
    Location
    US
    MS-Off Ver
    Version 16.18
    Posts
    6

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    Quote Originally Posted by Mumps1 View Post
    The macro assumes the data starts on row 1. What row does your data start?
    the data begins on row 4.

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

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    try
    Please Login or Register  to view this content.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    Try:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    10-21-2018
    Location
    US
    MS-Off Ver
    Version 16.18
    Posts
    6

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    Quote Originally Posted by Mumps1 View Post
    Try:
    Please Login or Register  to view this content.
    This works! THANK YOU

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Macro to transpose rows into columns and paste to specific columns in another sheet

    You are very welcome.

+ 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. [SOLVED] Copy specific columns in sheet A and paste in specific columns in sheet B
    By Vassen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-09-2017, 05:27 AM
  2. [SOLVED] Macro with text to columns, insert rows, and paste special>transpose
    By Schern in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-21-2016, 11:43 AM
  3. [SOLVED] Macro help with copy/paste and transpose across 3 columns into a 4th - same sheet
    By pharms in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2013, 03:51 PM
  4. [SOLVED] Macro with text to columns, insert rows, and paste special>transpose
    By diaphanous1138 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-22-2013, 02:49 PM
  5. Replies: 8
    Last Post: 04-04-2013, 08:02 PM
  6. [SOLVED] Transpose Rows to Columns VBA Code and delete specific account numbers
    By cowboys in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-19-2012, 06:10 PM
  7. Macro to copy paste columns to specific rows
    By ohjeez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2011, 12:08 PM

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