ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through workbooks in Folder (https://www.excelbanter.com/excel-programming/319716-looping-through-workbooks-folder.html)

Teresa

Looping through workbooks in Folder
 
The "List " Tab contains a list of 20 Jobs

I want to loop through the "List" Worksheet in every workbook in a folder,
copying the list to a "Consolidated" Tab.

So if "List" in Wbk1,Wbk2,Wbk3 has 20 Jobs.
Then list in "Consolidated" has 60


sub consolidate()

set path = "c/My Documents"

for each wbk in path
wbk.Sheets("List").Range("a1:a20") copy paste:
Workbooks("Consol").WorkSheets("ConList")

End Sub




Norman Jones

Looping through workbooks in Folder
 
Hi Teresa,

Ron de Bruin has some code at:

http://www.rondebruin.nl/copy4.htm - range

which demonstrates looping through workbooks in a specified folder and
copying a given range. This code could be adapted to suit your needs.

---
Regards,
Norman



"teresa" wrote in message
...
The "List " Tab contains a list of 20 Jobs

I want to loop through the "List" Worksheet in every workbook in a folder,
copying the list to a "Consolidated" Tab.

So if "List" in Wbk1,Wbk2,Wbk3 has 20 Jobs.
Then list in "Consolidated" has 60


sub consolidate()

set path = "c/My Documents"

for each wbk in path
wbk.Sheets("List").Range("a1:a20") copy paste:
Workbooks("Consol").WorkSheets("ConList")

End Sub






Bob Phillips[_6_]

Looping through workbooks in Folder
 
Teresa,

Here is a previous post that uses FSO to get the files from a folder. Just
add the copy code into this

http://tinyurl.com/6f2wa

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
The "List " Tab contains a list of 20 Jobs

I want to loop through the "List" Worksheet in every workbook in a folder,
copying the list to a "Consolidated" Tab.

So if "List" in Wbk1,Wbk2,Wbk3 has 20 Jobs.
Then list in "Consolidated" has 60


sub consolidate()

set path = "c/My Documents"

for each wbk in path
wbk.Sheets("List").Range("a1:a20") copy paste:
Workbooks("Consol").WorkSheets("ConList")

End Sub







All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com