Consolidate Data From Multiple Workbooks From Different Folders/directory

Feb 5, 2010

I was searching through the internet to look for some help with regards to consolidating data from multiple workbooks from different directories into a single worksheet called Summary.

I would like to copy the entire worksheet from different workbooks in different directories into this workbook I like to call Summary. To manually do it I have to open the workbook I want to copy the worksheet from. Right click on the tab and select Move or Copy, select the sheet I want to copy and select the workbook I want to copy this sheet to. Repeat this process for all the workbooks.

The next step is to copy and paste from these sheets into a main summary sheet. The data range from these sheets are starting from row 13 onwards and they may be of different size between Column A to Column W.

For example the workbooks are coming from :

S:Area 1West.xls from worksheet Andy
S:Area 1East.xls from worksheet Bill
S:Area 1North.xls from worksheet John
S:Area 1North.xls from worksheet Albert etc...

View 9 Replies


ADVERTISEMENT

Consolidate Data From Multiple Files Within Folders & Sub Folders

Aug 16, 2009

I have managed to get this far - I have put together a macro (from different threads on this site) that opens closed workbooks, copies data in one of the sheets (same sheet in each of 28 books), and pastes the data it into a master book sheet, each paste starting below the last. So that bit is working. The first bit of help I need is a line of code that will make the macro loop through a number of sub folders in a main folder. My code at the moment works as long as I specify a path that ends with the name of one subfolder, and it only loops through this subfolder. I would like the path to end at the folder that holds all the subfolders ('Workbooks' in the path below), and then add some code that tells it to apply the macro to all subfolders in this folder, so it loops through them all.

The second issue is that after the macro goes to the closed book(s), copies the data in there and pastes it into the master sheet (into columns E:FG), I then need it to go back to the workbook it just copied from, go the same sheet, to three specific cells on that sheet (FH1:FH3), copy the content, go back to the master sheet, and now repeatedly paste the content (values only and transposed) of these three cells into three cells (in columns B:D, with row number being dependent on what rows the first lot of data was copied into) next to every row it just previously pasted in for me. When it loops to the next workbook, it needs to do the same, and the three cells will have different content than the ones in the previous workbook paste.

I dont know how to define the range it needs to paste into the second time. I tried using the definition I used for the first paste (MCDrow), to tell it that it is the same rows, just different columns, but this is not working.

Here is what I have so far, which does the first part of what I need, except for needing a way to have it loop through all subfolder in the 'Workbooks' folder (at the moment it lists Barwon South West as a subfolder in that path, but I actually have multiple subfolders, not all called Barwon South (all different names) that it needs to loop through and do both the first and the second paste for. I have taken out the code I was trying to use to do the second paste, as this was not working and the code is pretty messy as it is (I sort of bumble along, being so new, and I know the code is not very clean or efficient!).

Can someone help me put in the few lines I need to loop through all my subfolders (if you give me an example I can probably extrapolate), but to get you started, three of the subfolders are Barwon South West, Eastern Region and Gippsland. And can someone help me put in the code that will do the second paste for each workbook?

Sub Click2()

Application. ScreenUpdating = True
Dim MCDrow As Long
'Dim SubFolders As String
MCDrow = ThisWorkbook.Sheets("Client Data").Range("A65536").End(xlUp).Row

Fpath = "Q:Clinical ServicesCS Statewide DatabaseWorkbooksBarwon South West" ' change to your directory
'SubFolders = True
Fname = Dir(Fpath & "*.xls")
Do While Fname <> ""

ThisWorkbook.Sheets("Client Data").Unprotect

Workbooks.Open Fpath & Fname
Worksheets("Client Data").Activate
Worksheets("Client Data").Unprotect

View 6 Replies View Related

Macro- Code To Transfer Data From Multiple Workbooks Within Folders

Sep 15, 2008

I have been given the following code to transfer data from multiple workbooks within folders and subfolders to retreive the same line of data from each of the workbooks and place them in a master workbook.

the folders are set up as follows,

there is a main folder, (a yearly folder)
within this are 12 monthly folders (named January to December)
within these are four weekly folders (named week 1 -week 4)
contained within these weekly folders are the workbooks that i wish to copy data from.

for example a1 - k1

the code i am using transfers the file names but comes up with #REF! instead of transfering the data

Here is the

View 9 Replies View Related

Consolidate All Data In Multiple Worksheets Of Multiple Workbooks In One Master File?

Jul 12, 2014

I need a macro that would consolidate all data in multiple worksheets of multiple workbooks in one Master file.

All the workbooks will be in one particular folder. The macro should search for data in all the workbooks and consolidate it in one master excel workbook.

I am currently using both excel 2007 and excel 2010. This macro would really reduce manual work as currently consolidating data from 45 to 50 sheets takes an ample amount of time...

View 4 Replies View Related

Consolidate Data From Multiple Sheets & Workbooks

Sep 23, 2007

I have been working on this project for some time and still haven't got anywhere with it. What I am essentially trying to do is create a master summary workbook where by you press a button to activate a chunk of VBA that will grab the same range of data from multiple workbooks but also multiple sheets in those workbooks, only problem is the number of sheets in each workbook are constantly changing so I need first find some way of accessing a closed workbooks, then I need a way of looping through a segment of code that will look into approximately 10 workbooks all with a different number of sheets and taking a fixed range of cells out of each sheet and for every workbook make a new tab and paste the information in that tab then move onto the next workbook, find the number of tabs (missing out the first 3 tabs of every workbook) and copy and paste the fixed range from each tab onto a new tab the summary workbook.
I will then have a summary workbook with a number of tabs, each one a different workbook with all the data from all the tabs in that workbook, I can then pull that information using formulas or some more VBA into a summary tab on the summary workbook, consolidating all of the information.

View 6 Replies View Related

Consolidate All Sheets Across Multiple Workbooks

Jun 30, 2014

I came across the following code, which does exactly what i want. It opens up all workbooks in a specified folder, and consolidates these into one. Each worksheet data is added below that of the previous workbook.

[URL]....

I have changed this to suit my workbook which has the header rows starting in row 6, but is now giving an error due ot the copy area not being the same size as the past area. It appears to be copying columns A:M and trying to paste this into the main workbook in columns A:N.

[Code] .....

View 9 Replies View Related

Consolidate Sheets Of Same Name From Multiple Workbooks

Aug 29, 2007

I have same kind of file stored in a folder every day. For example an expense statement that is being pulled every day has sheet tabs Mon, Tue, Wed, Thu, Fri. Every day it gets stored in a particular folder. I need to consolidate for say 4 weeks. All sheet tabs look alike. I need to consolidate all mondays, all tuesday sheets ... in a master work book.

View 9 Replies View Related

Consolidate Multiple Workbooks Into The Master Workbook?

Jun 12, 2013

how to consolidate multiple workbooks into the master workbook? I need to consolidate 12 workbooks into the master workbook every month. The subsidiaries will report me their figures monthly. Hereby attached one of the subsi, "B Co" reporting package, and the master copy "XYZ Holding Co" how it look like. Hence, may I know how to write a macro so that it will auto update monthly when the subsidiaries return me their reporting package, so that I can auto update in my master copy for tab BS and tab PL.

View 6 Replies View Related

Consolidate Multiple Workbooks Based Only On Pre-defined Cells

Apr 8, 2007

I have multiple workbooks in a particular folder. Each workbook has only one worksheet named "Data". I need a VBA script that could open each file in the folder, copy only particular pre-defined cells that have been mentioned in the script, and then place it one below the other on a new sheet.

Ex, if the pre-defined cell is A2, C6, and D7. I want the code to open all the sheets in the folder one by one, copy A2, C6, and D7 of each workbook opened, and paste it one below the other on the new workbook that is running the macro.

As an add-on, it would also be great if the next column cud carry the file name of from which workbook the information was picked out.

The result thus in the new workbook wud be like...

A2's data | C6's data | D7's data | File Name
Andrew Male Married march3.xls
Peter Male Un-Married march4.xls
Susan Female Divorced april2.xls

View 9 Replies View Related

Consolidate Multiple Spreadsheets (consolidate All The Data)

Oct 17, 2008

I have a workbook that has multiple tabs and need help trying to figure out how to consolidate all the data. I find myself spending hours doing this manually each day.

Here is what I have:

Workbook has tabs labeled....Wk1_Mon, Wk1_Tues, Wk1_Wed, Wk1_Thurs, Wk1_Friday, Wk1_Summary......and repeats all the tabs through Wk5....then I have a Month_Summary tab.

I have 25 users with 25 seperate workbooks each with individual information on each workbook.

I am trying to get a sum of all the data on the Month_Summary tab for each month for each user and as well as a sum of the Month_Summary tab for all 25 users.

The end result I am looking for is to get a Yearly Sum of all the Month_Summary Tabs for all 25 users as well as individual yearly summaries for each users.

I have one main Folder which contains 25 folders (one for each user). Under each user folder there is a seperate Workbook for each month.

View 2 Replies View Related

Code To Pull Data From Workbooks Across Various Folders

May 3, 2007

I've seen a lot of code on how to pull data from workbooks in the same folder. However, I'm trying to pull the data in workbooks in various folders.

For examply, I have one folder, called "Master Files". In this folder is 12 folders, one for every month of the year. Within these folders, is one for each week, with the last day of the week being the name for the folder. In other words, it's like \Master FilesApril4-6-07data.xls

Now, I know how to get the data I need if all files are within the same folder. But how would I write a macro to run through all of those files when they're in separate folders?

View 9 Replies View Related

Consolidate Data From Different Workbooks

Sep 7, 2007

I need a macro code to combine data from 2 different workbooks to a new workbook.

See attachments for ease of understanding.

Note:
- Data in sheet1 of both book1 and book2 should be pasted in a new book (eg: book3)
- The result I am looking for is like sheet2 of book1 (colour differentiation done for ease of understanding and not required to be implemented in the code). Also since I could attach only 2 books, I have pasted the desired result in sheet2 of book1.
- Also note that headings of book1, book2 and the resultant book3 will be same.
- Both book1 and book2 are stored in the same folder (im not sure if this info helps)
- It is important to note that data keeps changing and new rows will be added in either book1 or book2. So when I refresh the resultant book3, it should add these rows that were previously missing.
- First it should paste all data from book1 (old and new rows), then it should paste all data from book2 (old and new rows).
- I think the sheet2 of book1 will help you to understand what I mean by the above note.

The above exercise is for me to get a logic. In the actual scenario, there are more than 2 books to pull the data from. And also there are more than 20 columns to pick data from.

View 4 Replies View Related

Add Folders To All Directories Within Another Directory?

Nov 29, 2012

I am trying to automate some of the work I used to do as I have moved to another position, specifically trying to automate file management. I am using this code to create new files for each client

Code:
Public Sub CheckDir(fold1 As String)
If Dir(fold1, vbDirectory) = "" Then
MkDir fold1
Else
End If
End Sub

which works great, but you still have to do one client at a time. Basically I'm using this code to create new client files, but each year we will need to add a directory and sub directories for every client in a certain directory. What I would like to do is code a macro that would add say a "2013" folder with all appropriate sub directories to every client folder within the folder that contains all of the client folders The folder hierarchy should look like this

Code:
'F:Clients
'F:ClientsClientName
'F:ClientsClientName2013
'F:ClientsClientName2013RandomOtherFolders

I assume it would use a For/Each, but I'm not sure how to go about it.

View 3 Replies View Related

List Folders & Subfolders From Directory

May 20, 2007

how to list all the folders/subfolders (no files) of a specified directory?

I've seen a few examples of listing filenames from directories but I'm unsure how to just list folders/subfolders.

View 6 Replies View Related

Breakdown Of All Folders & Files In Directory

Sep 12, 2007

I am trying to specify all files and folders in a directory and the only help I found was the following thread: Create Index Of Files In Folder That works really well but, what I need is to specify all the folders and all the files under a directory, does any of you awsome hacks have an idea of how I can enhance the macro if the thread posted above?

View 3 Replies View Related

Loop Through All Folders In A Directory - Find Matching File

Jun 28, 2014

Code that loops through all folders in a directory, to check each workbook in each of those folders. If any workbook name in any of these folders matches a predefined string, then open this workbook for some other codes to run.

View 2 Replies View Related

Use Excel VBA To Copy Multiple Files From Different Source Folders To Different Folders?

Jun 12, 2014

I need to back up files, which may be excel or MSword, by copying them from different directories, say C: to the backup directory, say X:. any vba to backup the files? I expect the vba can copy all file listed in column A.

E.g. C: est1File1.xls or C: est2File2.doc, and then pasted to the directory in column B. e.g. X:BackupFolder1 or X:BackupFolder2.

View 1 Replies View Related

Processing Data In Multiple Folders

Mar 8, 2007

I have a VB codes to process the data from a file that located in the folder from directory. This VB will copy the data from the file and paste it into new workbook by clicking the command button. I want to modify this code in order to make VB can process the data from multiple file from multiple folders. Previously, I just write the code for one folder only. So now, I want to modifiy the codes in order to expand more folders. All the results will be pasted into the same workbook.

Private Sub cmdStart_Click()
Application. ScreenUpdating = False
Set outbk = Workbooks.Add
Workbooks.Open "C:" & TextBox1.Value & "" & TextBox2.Value
Sheets("bin_trip").Select
With ActiveSheet

View 9 Replies View Related

Open Workbooks In Two Folders

Jun 24, 2009

I have a script below that opens all the workbooks in a folder based on a msgbox. The script works as is. However what I would like to do is remove the msgbox and have the script go back and forth between the folders.

Example it would open one workbook in the (Large Area)folder call my other script (Hazleton_Data_Conversion) Return Open a workbook in (Varsity) Folder Call the
my (Hazleton_Data_Conversion)and repeat the process till all the workbooks in both folders have been processed.

Like I said this script works with the msgbox I just like to change to without msgbox and to flip back and forth.

View 3 Replies View Related

Consolidate Data From Multiple Worksheets

Jan 7, 2009

I have a workbook with 7 different worksheets (site_worksheets) containing data about various sites. I need to copy all this data into a single worksheet (worksheet_a). I want worksheet_a to update itself when another row of data is added to any of the site_worksheets.

View 12 Replies View Related

How To Consolidate Data From Multiple Worksheets

Nov 10, 2009

I have a worksheet that was created by converting a pdf file of 40 pages or so. The conversion process created 40 separate worksheets in one workbook. I would like to consolidate all the data on to 1 large worksheet.

View 9 Replies View Related

Macro To Consolidate Data From Multiple Sheets To One

Feb 11, 2014

I have the following macro, however I am struggling to make it work on my file:

[Code] .....

I have attached my sample. essentially i have the dec, jan etc month tabs to consolidate into the summary sheet. i would like the data to be dumped from both sheets into the summary sheets. i will be adding a feb, march, april etc tabs as the year progresses.

I would also like column A in the summary sheet to repeat the name of the sheet the data is being retrieved from.

Attached File : sample macro_issue01.xlsm

View 4 Replies View Related

Consolidate Multiple Rows Of Data Into Single Row

Jul 28, 2006

I imagine my goal could be achieved via some scripting code, but, alas, I don't do vbs. Here's the situation:
I have a spreadsheet generated by another office which lists individuals' names and information about participation in various programs. Each line lists name, address, program title and amount. The next line may be the same name, address with a different program and amount. Each person may have 4-5 entries. I want to make single entries for each individual, with colums showing the programs and amounts.
Current:
ID Name Address Program Amount
1 Bob home A 25
1 Bob home B 37
2 Dave home A 22
2 Dave home B 10
2 Dave home C 21

Need:
ID Name Address Program A Program B Program C
1 Bob home 25 37 0
2 Dave home 22 10 21

Hopefully this makes it a bit more clear. The only way I know how to accomplish this is the "old fashioned" long hand approach of cut & paste. There are several thousand individuals, with (currently) tens of thousands of rows.

View 9 Replies View Related

Copy, Transpose & Consolidate Data From Multiple Sheets

Jan 25, 2010

writing a macro that could save me loads of time. In the attached file there are 2 separate sheets of data ( named "Elements Innovation" and "Dinttap") that I need copied, pasted, transposed and consolidated into one master sheet (named "Desired result"). Note that the fields that relevant cells are highlighted in yellow. In reality I'll have many (~100) of these sheets that I need the data extracted from, and the work looks like it can be automated using VBA to speed things up.

View 2 Replies View Related

Macro To Consolidate Workbooks?

Nov 13, 2013

I need to create a macro that pull in data from various spreadsheets, all with the same layouts, but with different file names and different worksheet names, into on master worksheet. The data should drop in after the title line and then continue on after each data set has copied.

View 3 Replies View Related

Script To Consolidate Workbooks

Jul 8, 2008

I have a long task ahead of me and hope that someone may be able to assist in shortening it a little....?

I have a directory with circa 200 workbooks which have filenames that are dates in the format dd.mm.yy. The workbooks all contain just 1 sheet. I need to move each of the sheets into one master workbook and title each sheet with the old filename.

View 9 Replies View Related

Moved Workbooks To Folders Now User Form Subsript Out Of Range

May 19, 2008

The attached workbook has a userform which was searching the same folder where this file is located for entries in columns "A" and "B" of files named in column "I" (workbook1, workbook2 etc).

I have this placed on a sharepoint and want to move the files into specific folders (folder1/workbook1, folder2/workbook2 etc.) so I can set them as view only folders to stop unuathorised editing.

I am now getting a "Subscript out of range" error after doing a search. I can see it's a problem with the file name as it's pulling it from text in a cell but can't work out!

View 9 Replies View Related

Consolidate Data Multiple Worksheets Based On Naming Convention

Feb 3, 2008

I have a workbook composed of many worksheets with varying names. Of the 40 or so worksheets, 25 of them contain data that I need to copy and consolidate into a master summary sheet within the same workbook. All of the sheets I need to grab data from have a worksheet name that ends in “(Data)”. All worksheets contain data that starts on the same row (row 8) but the number of rows of data will change daily. When I copy the data range on the individual sheets I do not want to copy the header row. I’ve tried various uses of the offset command with no luck to resize the selected range. I’ve also tried giving each range a named Dynamic Range and referring to this name in VBA code but that didn’t get me very far either. So the flow looks something like this:

1. Find all sheets with name ending in “(Data)” (i.e. “Project X (Data)”)
2.For each sheet found, find the data range and omit the first row of data.
3.Copy selected range.
4.Go to sheet “Master” and find the last row of data. Move down one row to the first empty row and paste copied range.
5.Go to next sheet and repeat.

View 9 Replies View Related

Macro To Consolidate Various Workbooks Into Onesheet

Oct 12, 2009

I have to maintain a weekly tracker for my team. 13 team members will send me thir trackers every trackers every week and I need to consolidate all of them into 4 weekly and 1 monthly tracker. is there a macro which can facilitate this compilation of 13 excel workbooks into one new worksheet? all worksheets will be similar i.e will have same # of columns but can have different # of rows.

View 9 Replies View Related

Count Number Of Workbooks In A Directory

Feb 14, 2008

Is there a way in VB to count the number of workbooks (*.xls) in a directory.

The outcome must be presented in range("A1").

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved