Accessing Data From Worksheets In Multiple Workbooks
Jun 27, 2008
I have read all the rules, and the guidelines for writting a thread title, and can only hope that my title meets those criteria (Dave, if they do not please do not ban me). I am fairly new to VBA, I have been able to edit other peoples code, and have created a few macros myself, and although I think I know how to use a loop and arrays, I sometimes lack some of the basics, this may be one such case. That said here is the problem I am facing.
I am creating a database, and as such I am sent several workbooks, with each workbook containning several worksheets. Within these workbooks, the naming convention of the worksheets is consistent, though each workbook may contain different number of worksheets. (the name of the worksheets represents a specific size/format).
What I have is a "Setup sheet" that I would like populated with all the data from specific worksheets in the various workbooks. So I would need to be able to get the macro to check all the workbooks, and if it finds a worksheet entitled "Sheet B" (for example) that it copies all that data into the "Setup sheet", and progresses onto the next workbook. I have the loop working and am fairly confident on this side of things, though where I am struggling is getting the Macro to know what worksheet to look at when going through the workbooks.
I need the macro to be fairly dynamic in which Worksheet it looks at so I don't want to simply hardcode the Worksheet name into the macro, rather I would like to be able to specify the worksheet name based on a cell value in the "Setup sheet". so going back to my earlier example if the cell value in the "Setup sheet" = "Sheet B" then the macro should get data from the worksheets entitled "SheetB" in the workbooks, if the cell value in the "Setup sheet" = "Sheet F" then the macro should get data from the worksheets entitled "Sheet F".
View 2 Replies
ADVERTISEMENT
Jan 22, 2009
I have 100 or so workbooks named A1234.xls, A1235.xls, A1236.xls etc.
I want to gather information from the same worksheet and same cell in each workbook.
I want this information in a separate workbook named Master.xls
In the Master spreadsheet I have the workbook names in column A e.g.
A1234
A1235
A1236 etc.
In column B, I want the information form each of the 100 workbooks. For example, from "sheet 1" Cell C2. This is the same place I want the information from in each workbook.
Is there an easy way of doing this with a formulae rather than a macro. For example, in the Master spreadsheet column B1 formula would read =[A1234.xls]Sheet1!$C$2 ... and then can you drag this changing the filename according to column A in the master spreadsheet?
If not can a macro be used? I have only started looking at macro's and my knowledge on them is very basic.
View 9 Replies
View Related
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
Feb 22, 2014
I have a master workbook that has been set up to mirror the structure of a single worksheet in various other workbooks saved in different directory locations. I need some VBA code to retreive specific data from a specified worksheet in multiple workbooks which are saved in different directories and then copy the data to the master workbook, listing each data set one after another. I do not want to open any of the source workbooks to acheive this.
I attach two example workbooks to better explain:
The code has to look in various sub directories to find the relevant workbooks, (Source1) then find the specified worksheet, (Stock) and copy only rows that have data from column B to O. The data needs to be copied to the master workbook, (master) from all the source workbooks as a list with no space.
View 4 Replies
View Related
May 19, 2014
(Code at the bottom of this message)
I have a file with a roughly 20 workbooks. I need to split the data in each workbook into two sheets, rename each sheet, then export the data to template with multiple sheets. After splitting the data into the appropriate sheets in the original workbook, Sheet1 in has only 1 row (plus header) and needs to be transferred to "Project Entry" in the template; Sheet2 can have any number of rows (less than 100) and needs to be transferred to "Activity Entry" in the template. I need to save the template based on the value of cell A1 on "Project Entry" sheet of the template. The organization of the columns in the original workbooks is different than that of the template, so this is not a straight copy and paste operation. The cell formatting in the template must be retained.
I have half of this under wraps. I've cobbled together some code that splits the original data where I need it split, copies it to new sheets and saves the files. I now need to figure out out to get it out of this saved file and into the template.
The crosswalk of values between the original data (Sheet1) and the template(Project Entry) needs to look like the below. So, variable 1 exists in column B of the original and needs to populate column B of the template, and column Q in the original needs to populate column G in the template. The variables and column relationships are different for Sheet2/Activity Entry.
SPREADSHEET COLUMN
Variable
Original
Template
[Code]....
View 3 Replies
View Related
Jan 6, 2009
I'm currently doing a survey using an excel workbook that contains multiple questions across multiple worksheets using radio buttons linked to certain cells.
I have around 400 workbooks coming back to me, so what i want to do is take specific values from across many worksheets within each workbook and combine them into a large master table in a seperate workbook.
I've tried using VBA, but not being very proficient at it i've hit a brick wall with that, so i'm hoping that there is an easier way to do it than what i'm currently pursuing.
View 9 Replies
View Related
Apr 21, 2008
i have a simple PO tracking system, i have a workbook with multiple sheets at any one time approximately 20, projects come and go and i need to add a sheet periodically, rename the tab to the project ID - 4x numeric.
All this i have managed to do, and sort the sheets numerically, i now need to copy the last (added) row on the Project specific sheet to the last clear row on the summary sheet.
I have also achieved this, but in order to do it properly i need to switch between the specific Project sheet i am adding the current PO to, (any one of 20) and the summary data sheet, the sheet i am copying to.
To achieve this i thought i could assign the TabName (of the Project) to a variable and then refer to it
Sheets(TabName).Select. using msgbox throughout appears to provide the correct results, however, this produces a {subscript out of range error no9} on this particular line. Any suggestions welcome. Same issue i believe i could address my problem if i could whilst in the Project specific sheet i could determine the codename of the sheet which i believe i could then use to switch between sheets programatically.
View 9 Replies
View Related
Feb 28, 2009
I have a few hundred multi sheet workbooks that have address data in one of the sheets that I wish to collate into a single worksheet to use as a mail merge with word.
View 5 Replies
View Related
Jul 18, 2006
I have a master workbook that has three sheets: Application, Equipment, Storage. I have over 500 other workbooks that have those same three sheets in them. Those workbooks also have other worksheets that I do not want. How can I create a macro that will open every one of those workbooks and copy over the data from each one of those 3 sheets into it's counter part in the master workbook?
View 3 Replies
View Related
Sep 5, 2008
I would like to append multiple workbooks with multiple worksheets in a separate workbook. For eg. I have workbook "A" with sheets 1,2,3 and workbook "B" with sheets 4,5,6. Now I want to append "A" and "B" to create workbook "C" with sheets 1,2,3,4,5,6.
View 9 Replies
View Related
Jan 28, 2009
I have a folder - U:30000 - that contains a number of identically layed out workbooks. What I'm trying to do is, in each, change a number of cell values. Where dominicb's solution to the previous problem didn't work for me, however, is that I need to change cells in multiple worksheets. The cells are specifically:
On worksheet 'Construction': C3 (which is a date), D3 (which is a text value); on worksheet 'FF&E': D3 (the same text value as D3 on 'Construction'. Unfortunately, whoever initially set up the workbook didn't have the foresight to link it!)
View 4 Replies
View Related
Dec 27, 2013
Code to merge worksheets from different workbooks stored in different location.
I have a sheet called "Master" in all the workbook I want to combine.
I have a unique password for all the workbook as well.
All the workbooks are stored in different folder location.
I would like to do a paste special values when the consolidation takes place.
View 1 Replies
View Related
Sep 7, 2006
I'm trying to combine data from several worksheets (one sheet per workbook) into a single, consolidated master worksheet for reporting purposes (filters and pivot tables). We do not need to keep formulas for the master worksheet, only values and formats. Individual worksheets are used by different users to capture case data in a Human Services field. Column headings are identical, but rows contain data on individual cases. I'm trying to find a relatively easy way to combine multiple worksheets into a single master. After I establish the worksheets and technique, it will be operated by extremely basic users so I've been reluctant to use extensive macros.
Because of complex reporting needs, the exact combination of worksheets being combined for reporting may vary. For example, one time I may combine Tom, Dick and Harry, another time Tom, Dick and Bob, and yet another time Tom, Dick, Bob and Harry. Obviously, one method is to cut and paste the rows into a single worksheet. Are there more elegant solutions that could easily be handled by very basic users? Worksheets are stored in a single folder along with a separate worksheet used for validation rules (as you can guess, this would ideally be a database application but for various economic and political reasons we are using Excel). One possibility, if straightforward, is to use Access to consolidate data then export it back to Excel for analysis. I've scoured the various threads but have not found a situation mirroring mine. The number of rows for each worksheet is generally less than one hundred, but there will be a few exceeding several hundred. Total numer of rows of the resultant master worksheet will not exceed 10,000.
View 4 Replies
View Related
Apr 2, 2014
Im trying to copy multiple workbooks and just save it into only one worksheet. I have 2000 diffrent workbooks with the diffrent amount of rows, The ammount of cells is the same and it dosent change.
im working on a excel 2010
This is what i got for the moment..
Sub LoopThroughDirectory()
Dim MyFile As String[code].....
View 1 Replies
View Related
May 14, 2012
I have 2 nearly identical workbooks and I need to update historical data from the old workbook into the newer one.
My current Coding Snippets that I want to use look like the following:
Code:
Sub UpdateWorkbook()
Dim ws As Worksheet
Dim r1 As String
Dim r2 As String
Dim r3 As String
Dim r4 As String
Dim r5 As String
Dim r6 As String
[code]....
Now, this code isn't working I suspect because the Copy and PasteSpecial Functions don't work the way I wish to.
View 4 Replies
View Related
Apr 29, 2014
I get 'x' number of workbooks(with one sheet only) everyweek from which I need to copy data and paste to a master worksheet. (SCREEN CAPTURE BELOW)
I am unable to write the code myself as I have never worked on VBA and am only a beginner.
Part I:
The data I need to copy starts from the 19th row (A19:H19). The end point is determined by the row just before the row that has the words "Calibration Request" in it.
Part II:
Just below the data that was pasted from Part I, the data from 2 rows below the words "Calibration Request" needs to be pasted. The end point for this would be a blank row encounter.
Also some of the rows and columns are merged.
View 9 Replies
View Related
May 28, 2014
I am currently looking for a front end program to access multiple excel files at once. In a nutshell, I work for a company that uses subcontractors. Each subcontractor is graded in about 7 different performance categories. I receive daily excel files that give us the results for each category. I get separate files for each category.
What I do right now is use a master excel file. Every day I take each file I receive from our parent company and add it to the master file. I have a huge excel file that has a separate tab for each performance category. Then I have a "Report" tab where I use various formulas to summarize a sub's performance over a certain date range.
Essentially, the report tab is just a neat and concise way to display the stats of an individual sub, an office, a region or the whole company. I use tons of VLOOKUP and COUNTIF(S) formulas to look over the hundreds of lines of data and bring back the stats. It works but it is just not very efficient as I get hundreds of new lines of data every day.
View 4 Replies
View Related
May 14, 2014
I track distribution using 1 workbook for each sales rep. Each workbook has a separate worksheet (scorecard) for each of their locations showing which of our products are used in that location, for various functions. Each of the locations has a segment (bar, nightclub, casual dining, etc.), and a class (AA, A, B, etc.). All of the scorecards are identical, and are in the same file folder on our shared drive.
Sample:
Location A Class:AA Segment: Sports Bar Rep: John Smith
Product: Product X Product Y Product Z
Well: 1 0 0
Back Bar: 0 1 0
Cocktail Menu: 0 1 1
I was unable to find an HTML maker so this is not an actual sample but what I'm looking at. The above data indicates that for location A (Sports Bar, Class AA), Product X is used as the well, Product Y is on their back bar and their cocktail menu, and Product Z is not used at this location at all.
I need to set up an analytic workbook where I can sum data based on multiple and grouped criteria, and for multiple reps ie- display a scorecard that shows totals for nightclubs and sports bars, class AA, A, and B, for a particular rep; OR display a scorecard that shows totals for nightclubs, class A for a group of reps. Ideally I would like to do this using drop down menus that allow the user to select multiple criteria in each of the drop downs, having the data auto-populate based on those selections.
View 2 Replies
View Related
Jun 26, 2014
I have 25 files with certain worksheets that I need to move to 25 other files.
Worksheet 1, 2, 3 and 4 in Workbook A needs to be moved to Workbook A-2014 Worksheet 1, 2, 3 and 4 in Workbook B needs to be moved to Workbook B-2014 Worksheet 1, 2, 3 and 4 in Workbook C needs to be moved to Workbook C-2014 etc....
Is there a way to do this with a macro? Preferably I would like to do this automaticly - i.e. runing the macro from a master file that
1. Opens Workbook A copies the worksheets
2. Open Workbook A-2014 paste the sheets
3. Save and close Workbook A-2014
4. Close workbook A without saving
then doing the same for Workbook B, etc.
View 5 Replies
View Related
Jan 17, 2008
How can i access data from other workbook i have opened.?
I am new in VBA.So little code snippet would be good to show.
I want to get the cell data from workbook2 to workbook1
View 9 Replies
View Related
Jan 22, 2014
I followed the instruction in the TechRepublic article "10 steps to creating a scrolling Excel chart"; [URL].... The problem is that the scroll bar stops working at a certain point and will not bring up the last 8 months of year 4 of my data. I get error messages and the chart turns blank.
I also tried a different method (again for a scroll bar and a rolling chart) as outlined in [URL].... There are a number of similar articles with almost identical formulas. Here, the first 8 month of year one are inaccessible = error messages and chart turns blank.
I have 4 years worth of temperature data. The original data table from where the Index function draws the data is 1463 rows long (minus 2 rows for the header). The "magic" number where the scroll bar stops working is 995 for the current value. From a current value of 994 onwards, the entire matrix displays error messages "Ref#".
In the second case, the magic number is 1242 which equates to August of the first year. 1241 and lower for the current value will freeze the chart.
How the scroll bar control generates and gets hung up on either of these two magic numbers is a mystery to me.
I set the control properties at the beginning, i.e. Jan 1 of the first year to: Current value =1, Minimum =1 (I also tried 0), Maximum = 1500, Incremental =5, page =30, linked cell =$E$2. What is most puzzling to me is the fact that the scroll bar does work but only for part of the data set.
View 1 Replies
View Related
Aug 2, 2013
I have three source workbooks that needed to be consolidated into a master workbook pasting the data with values & formatting.
The Master workbook also contains 6 additional worksheets that link to the data pulled in from the source files.
My question is how do I write the code so the source files populate the master in a specific order.
For example, the 3 source files are named "Central" "NED" and "WEST" and I need them to populate the master workbook in that order.
This is the code I am using to consolidate the data:
Option Explicit
Sub ConsolidateSheetsFromWorkbooks()
'Author: Jennifer Starr
'Date: 7/12/2013
'Summary: Open all files in a folder and merge data (stacked) on all
[Code] .....
View 1 Replies
View Related
Dec 8, 2009
I have a folder which contains a number of Workbooks which were all built using the same template, therefore the layout and formatting is identical in each one. Cells A1:B15 of these workbooks contain information which I am attempting to extract.
I have been asked to build a worksheet with two cells for user's input. The first cell is the 'Directory location cell' and the second cell is the 'Policy Number Cell.' The policy number is found in Cell A2 of every workbook.
The idea in mind is that the user inputs the directory location in the first cell, the policy number they are searching for in the second cell and then excecutes the macro. The Sheet would then return all of the valuable information from whichever workbook contained it.
I think I need to compose a macro which trawls through the folder specified in the 'Directory Cell,' opened every xls until it found the policy number which matched the value in the 'Policy Number Cell' and then returned the cells A1:B15 into the new Sheet.
View 14 Replies
View Related
Oct 29, 2009
I am trying to create functions in VBA and I need to extract data from multiple workbooks. For example, is it possible to sum data(numbers) contained in multiple workbooks using VBA? If so, how do I create that function in VBA.
View 9 Replies
View Related
Jul 18, 2006
I have a lot of paperwork that needs to be entered into Excel. When I finsih entering the data, there will be many workbooks containing many different worksheets. I know how to summarize each workbooks but is there a way I can add specific columns in each of those summary sheets into a new workbook? I guess the question is can I sum data from different workbooks into a new workbook?
View 5 Replies
View Related
Jun 14, 2007
I have 2 Excel templates using lookups to create customer quotations. When complete a macro is run which strips out formulas and links to data.
I would like to record certain data from the finished workbook in another workbook on the server e.g. quote number, date, customer, total value, follow up date.
Is it possible to include another macro that records data in certain named cells to a separate workbook when the file is saved?
View 9 Replies
View Related
Jun 14, 2007
I've got a variable row length list of data, 24 columns wide with column headers in row 7 and file descriptions on the above rows, that I need to split up into seperate Workbooks dependant upon values in the last column, all rows with the same value in column X form the same new Workbook, which I can then SaveAs with a name associated with the value. I've seen a similar thing done to sheets on the forums by using the Advance Filter and I would adapt that to copy each created worksheet to a new workbook, but a) this seems inefficient and b) my unique values are too long to name sheets from.
View 6 Replies
View Related
Jan 10, 2008
Engineering has given me 300 separate 2003 Excel Files. Each of these individual Excel files contains data I need for creating a list I have been tasked to do. Cells E3, K1, A6 and J2 in each Excel file contain the data I need for my list. Rather than manually data mining 300 separate Excel files for data I need from Cells E3, K1, A6 and J2, can this be done automatically with a macro?
I'm seeking for the Macro to automatically OPEN each individual Excel file, then copy the data from Cells E3, K1, A6, J2, and then paste this data into a list file with four columns. After the pasting is done, the macro will close the source data Excel file and move on to the next one. In the future I will have to repeat this task with probably 400 individual Excel files. Therefore, it will be great if the Macro didn't care how many Excel files required data mining.
View 4 Replies
View Related
Oct 17, 2013
I'm trying to solve i have multiple books but each book contains same information e.g
Book1
Sheet 1
Date
Name
Sheet 2
Location
Postcode
Book 2
Sheet 1
Date
Name
Sheet 2
Location
Postcode
etc ... there is also multiple sheets in each book all are same layout just each book is different customer.
I'm trying to do is have a Listbox that shows all customer name and link back to His/her file location. Then retrieve certain information and display on blank workbook?
Question:
Can this be done without opening workbook
Considering i have 20+ workbooks and growing is this even possible
Cannot merge workbooks into one as this info is supplied by third party
View 1 Replies
View Related
Aug 13, 2014
I'm trying to set up an excel that will allow me to gather data from multiple workbooks and get it into one master worksheet. All of the worksheets are formatted the same way (See below)
Employee Last Name
Employee First Name
Employee Position
Employee Series Number
Departing City
Departing State
Attended Pilot Training?
We don't have the data yet so the idea is to paste this information into their perspective worksheets and then have them automatically populate into the master tab.
View 1 Replies
View Related