+ Reply to Thread
Results 1 to 5 of 5

Consolidate specific cells from all workbooks in a directory

  1. #1
    Forum Contributor
    Join Date
    03-18-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2010
    Posts
    139

    Consolidate specific cells from all workbooks in a directory

    Hey Guys,

    I want to extract data from 30 files, with the same structure, that I have placed in a directory together with the consolidation file.

    The idea is to run a macro on the consolidation file with the following instructions:

    1. Copy from Sheet Data1, Range C6:C26, to the first empty column on the consolidation file, sheet "Cons", Range B2:B22 (next one must be on C2:C22, then D2:D22, etc).
    2. Copy from Sheet Data1, Range D6:D26, to the first empty column on the consolidation file, sheet "Cons", Range starting from cell B29:B39
    3. Copy from Sheet Data1, Range E6:E26, to the first empty column on the consolidation file, sheet "Cons", Range starting from cell B57:B67
    4. Copy from Sheet Data1, Range F6:F26, to the first empty column on the consolidation file, sheet "Cons", Range starting from cell B85:B95
    5. Close this file and process the next one

    Is this something easy to do ?

    Thank you in advance!
    Last edited by dreddster; 05-11-2015 at 11:12 AM.

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

    Re: Consolidate specific cells from all workbooks in a directory

    Your first range is 21 cells each in the source and the destination ranges.

    But the next 3 copy ranges are still 21 cells each, but the destination range are only 11 cells. I'm ignoring that in this solution and making all the targets 21 cells, too.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 05-12-2015 at 11:35 AM. Reason: Fixed the RESIZE() code. Increment NextCol properly
    _________________
    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!)

  3. #3
    Forum Contributor
    Join Date
    03-18-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Consolidate specific cells from all workbooks in a directory

    Thanks Jerry!

    I added the macro, but it doesnt seem to copy the data properly. May I ask you to have a look? I am attaching the consolidation file and the data file. I setup the macro to look for files in a subdirectory called Files.

    Thank you in advance!
    Cons.xls
    Data.xls

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

    Re: Consolidate specific cells from all workbooks in a directory

    Oops! (blush)

    Fixed above, all the RESIZE parameters were hitting columns instead of rows. I also forgot to increment the columns as we work through the data books.
    Last edited by JBeaucaire; 05-12-2015 at 11:35 AM.

  5. #5
    Forum Contributor
    Join Date
    03-18-2013
    Location
    Bulgaria
    MS-Off Ver
    Excel 2010
    Posts
    139

    Re: Consolidate specific cells from all workbooks in a directory

    Awesome Jerry! It is perfect now!

    Thank you!

+ 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] Unhide hidden Workbooks in a specific directory by password
    By egemencoskun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-27-2014, 11:19 AM
  2. [SOLVED] Copy specific cell in various workbooks to another workbook, but in consequtive cells
    By andreroux in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-06-2013, 10:49 AM
  3. [SOLVED] Copy specific cells from multiple workbooks and import them to a master workbook
    By Alby22 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2012, 12:45 PM
  4. [SOLVED] Macro To Copy Specific cells From Multiple Workbooks to New Summary Workbook
    By Mooseman60 in forum Excel Programming / VBA / Macros
    Replies: 36
    Last Post: 06-19-2012, 07:38 AM
  5. Copy sheet to all workbooks in a directory AND..
    By mikeyfear in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2008, 03:00 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