+ Reply to Thread
Results 1 to 3 of 3

Loop through files in a folder

  1. #1
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Loop through files in a folder

    Hi everyone,

    I have been struggling with this issue for a while. I have macro that works fine for an individual text file. I want it to loop through all the txt files in a specific folder and perform the same procedure on all the files in that folder. After much searching, I know that I need to use the Dir Function but everytime I get a brick wall. Does anyone have experience looping through text files with Dir? Or if you know of a better way, I am open to all suggestions.

    Thanks.

    abousetta
    Last edited by abousetta; 04-28-2010 at 06:03 PM.

  2. #2
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Loop through files in a folder

    Shg kindly developed this code below in a previous thread http://www.excelforum.com/excel-prog...o-columns.html and I have attempted (and failed) to make it loop through several files in the same folder. The modified code is as follows:

    Please Login or Register  to view this content.
    Could someone have a look and tell where I am going wrong?

    Thanks.

    abousetta

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Loop through files in a folder

    I finally got it to work with help from a previous post http://www.excelforum.com/excel-prog...ext-files.html. I modified the code as below:

    Please Login or Register  to view this content.
    I hope this helps anyone else that might have the same problem. Its still not clear what the problem was, but I noticed that my loop was not 'broken'. In any case, I hope that this post will be of help to someone else.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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