Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to Pull Data from Seperate Workbooks
Dave
This should do the job you need to modify the selection criteria and the get data lines. Sub getdata() ' directory where the data is with the trailing \ Const cszDir As String = "C:\data\" ' prefix for the file name Const cszFilePrefix As String = "file" ' extension for the file name Const cszFileExtension As String = ".xls" Dim wsd As Worksheet Dim wbc As Workbook Dim lRowDst As Long Dim szFileCur As String Dim szDir As String Set wsd = ActiveSheet lRowDst = 2 szFileCur = Dir(cszDir & cszFilePrefix & _ "*" & cszFileExtension) Do While szFileCur < "" Set wbc = Workbooks.Open(szFileCur, , True) 'get data wsd.Cells(lRowDst, 1) = wbc.Worksheets(1).Range("A1") wsd.Cells(lRowDst, 2) = wbc.Worksheets(1).Range("C1") wsd.Cells(lRowDst, 3) = wbc.Worksheets(1).Range("D1") '.... wbc.Close False szFileCur = Dir lRowDst = lRowDst + 1 Loop End Sub -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "Dave" wrote: I need to find a solution to the folowing problem: There is a network folder with an Exel workbook for every week in the year. Each Friday it is updated with one new sheet for that week. All the data contained is in the same format. I need to create a single file that when one presses a button, will go through all of the workbooks in the network drive and pull specific information and populate it into the one file. Is this possible? Any help would be appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Need to pull data from the same cell in multiple workbooks. | Excel Discussion (Misc queries) | |||
Copy/ move selected data from workbooks to seperate worksheets or workbooks | Excel Worksheet Functions | |||
Macro to Pull Data from Seperate Workbooks | Excel Programming | |||
macro to move and save all sheets to seperate workbooks | Excel Programming | |||
How can I pull data from multiple user workbooks into one? | Excel Discussion (Misc queries) |