+ Reply to Thread
Results 1 to 8 of 8

Macro to copy transposed ranges to master sheet

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Cork, Ireland
    MS-Off Ver
    Excel 365
    Posts
    149

    Macro to copy transposed ranges to master sheet

    Hi

    I'm working on a macro to copy specific data from all (identically structured) files in a specified folder into a single master file.

    The macro copies a specific selection of ranges in each file and then transposes those into a single row (for each file) in the master file.

    It's almost working but when I run the code, it copies the correct selections but won't move to a new row for each file's data.

    here is the code I have:

    Please Login or Register  to view this content.
    I'd really appreciate any help with this.

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

    Re: Macro to copy transposed ranges to master sheet

    Reset the column counter lx to zero for each file

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to copy transposed ranges to master sheet

    This should do it.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 10-10-2016 at 07:07 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Cork, Ireland
    MS-Off Ver
    Excel 365
    Posts
    149

    Re: Macro to copy transposed ranges to master sheet

    Thank you both!

    Alphafrog - works perfectly.

    Jerry - only seems to pull data from one file? I can't see where it's going wrong...

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

    Re: Macro to copy transposed ranges to master sheet

    You're welcome.
    Jerry's isn't propagating the row counter NR for each file.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to copy transposed ranges to master sheet

    Thanks AlphaFrog, I've updated the code in post #3 to do that correctly. (high-five)

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

    Re: Macro to copy transposed ranges to master sheet

    Or if your Master Workbook is in the same folder.
    With an Array instead of looping for each cell.
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Cork, Ireland
    MS-Off Ver
    Excel 365
    Posts
    149

    Re: Macro to copy transposed ranges to master sheet

    Thank you all for your help on this, it's working perfectly.

+ 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. Macro Button to copy last row of data, transposed, skipping a row to another sheet
    By travreed7 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2015, 01:59 AM
  2. [SOLVED] Macro to copy data from a master sheet to separate sheet as per date using a macro
    By tmaster81 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2014, 08:05 AM
  3. Replies: 1
    Last Post: 04-11-2014, 09:59 AM
  4. Copy ranges of data from Master Sheet to Slave Sheets
    By mike.haley in forum Excel General
    Replies: 0
    Last Post: 01-23-2013, 12:51 PM
  5. Conditional copy of a column in one sheet to another workbook transposed
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2012, 08:49 AM
  6. Replies: 1
    Last Post: 08-09-2012, 09:58 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