+ Reply to Thread
Results 1 to 7 of 7

Copy same ranges in all excel files in a folder into a single workbook

  1. #1
    Registered User
    Join Date
    12-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Copy same ranges in all excel files in a folder into a single workbook

    Hi Everyone,

    I'm trying to write a code that copies the same ranges in all files in a folder(C:\Users\ple\Desktop\DTF-CRF) into a master workbook with column headers.
    All of the excel files in the folder will contain a sheet named "Screening".
    Cells K6 (Patient ID), K7 (Visit), C59 (Name), and P59 (Date) need to be copied from each workbook and pasted into their appropriate columns in the master workbook.
    The columns in the master workbook are as followed:
    A:A(Patient ID)
    B:B(Visit)
    C:C(Name)
    D:D(Date)

    There will also be other excel files added to this folder on a daily basis.

    Any help is appreciated.

    Regards,
    Phil

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy same ranges in all excel files in a folder into a single workbook

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy same ranges in all excel files in a folder into a single workbook

    Sorry for the long reply, I was bogged down with other work yesterday and just got around to it today.

    I updated the code with my data below. I also added code that pulls from a second sheet that is similar to the 1st sheet.
    All of the columns are the same as the first sheet except for rows I, J, and K.
    The issue is that when the data for I, J, and K are copied, they are pasted in the first empty cell in that column. I would like for them to be pasted in the same row as all of the other data pulled from that sheet.


    Please Login or Register  to view this content.
    Last edited by ple; 12-17-2013 at 03:42 PM.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy same ranges in all excel files in a folder into a single workbook

    Which Column would define the last row of data?

  5. #5
    Registered User
    Join Date
    12-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy same ranges in all excel files in a folder into a single workbook

    "N" will be the last column of data.
    Last edited by ple; 12-17-2013 at 06:39 PM.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Copy same ranges in all excel files in a folder into a single workbook

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Copy same ranges in all excel files in a folder into a single workbook

    I've tested the code above and unfortunately it doesn't work. The data is being correctely pulled although the second sheet data is overwriting the first sheet data in the master resulting in the data from the second only.
    Last edited by ple; 12-18-2013 at 01:16 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. [SOLVED] VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new
    By Bikeman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-02-2013, 07:59 PM
  2. excel macro to copy data from multi text files in a folder to a single work sheet
    By dil_se in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2012, 08:10 AM
  3. [SOLVED] Copy Values From Each Workbook in Folder to a Single Sheet in New Workbook +Workbook names
    By Arsham24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-21-2012, 07:42 PM
  4. Merging particular worksheet from Multiple Files in a folder into a single workbook
    By excelhelp18 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-30-2012, 01:37 AM
  5. Copy a row from 3000 excel files stored in a folder and paste it in a new workbook
    By hubertus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-28-2009, 10:34 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