+ Reply to Thread
Results 1 to 4 of 4

Loop Through a Folder of Excel Workbooks

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    6

    Loop Through a Folder of Excel Workbooks

    I have been looking for a solution all day and would be grateful if someone could help me.

    I have 100's of .csv workbooks in a folder "C:\ASA Japan\Database\3-Stripes\ASA output files". They are all saved in the same format with specific file names which is fine so far. What I need is a Macro which will search through this folder selecting all the data on each workbook between A1:CP2 and then copy that data (from all the sheets) into one existing work book "C:\ASA Japan\Database\3-Stripes\Database.xlsx" on sheet "Database" starting from B2:CQ2 filling in as many rows as required. The macro shouldn't search for data in Sheet1 in any of the "C:\ASA Japan\Database\3-Stripes\ASA output files", it should look for any data on any sheet located in that folder between the range A1:CP2.

    I have found many macros that create new work books, but none that copy to a range on an existing work book.

    Thanks in advance

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Loop Through a Folder of Excel Workbooks

    Are they all .csv? I thought csv's' were limited to one sheet per workbook...
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Loop Through a Folder of Excel Workbooks

    It might take a while to get through all of those files but you can try:
    Please Login or Register  to view this content.
    Last edited by Solus Rankin; 10-01-2013 at 12:24 AM. Reason: code edit

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Loop Through a Folder of Excel Workbooks

    Hi, frankgbr,

    maybe have a look at CSVs to 1 Sheet. Jerry used UsedRange for the entire contents to be copied, you would need to replace that by Range("A1:CP2") to suit.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for 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] Loop to open all workbooks in folder and append data to single sheet
    By beng404 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2013, 01:45 PM
  2. VBA loop through all workbooks in folder copy data into new summary tab
    By Beany213 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2013, 06:03 AM
  3. [SOLVED] Macro to loop through workbooks in folder and attach and email using address in closed WB
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-03-2013, 07:23 PM
  4. For loop which goes through all workbooks in a folder
    By secondrate in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2010, 02:49 PM
  5. Loop through folder of workbooks and add rows
    By FIRSTROUNDKO via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-10-2006, 02:55 PM

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