+ Reply to Thread
Results 1 to 6 of 6

Repeat macro for every file in the folder.

  1. #1
    Registered User
    Join Date
    03-20-2012
    Location
    Dunedin NZ
    MS-Off Ver
    Excel 2011
    Posts
    14

    Repeat macro for every file in the folder.

    Hi experts.

    I have a bunch of tab delimited files in different folders which have the wrong format of date in Column B. So I made this macro to change the date from dd/mm/yy into dd/mm/yyyy.

    Please Login or Register  to view this content.
    Is there a chance that I can run this macro automatically through all the files in a special folder?

    Thanks heaps

    Klara

  2. #2
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Repeat macro for every file in the folder.

    Something like:

    Please Login or Register  to view this content.
    You'll need to be sure that the workbook that contains this macro is NOT in the folder you're running your search on.....or it'll get saved and closed as well.

  3. #3
    Registered User
    Join Date
    03-20-2012
    Location
    Dunedin NZ
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Repeat macro for every file in the folder.

    Hey, Swoop99! Thanks heaps!

    I changed .xls to .txt because my files are tab delimited files, correct? And I changed the address of the folder. But somehow it stops at "With Application.FileSearch"

    What is wrong??

    Please Login or Register  to view this content.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeat macro for every file in the folder.

    The .Filesearch method was taken out of Excel after Excel 2003. The DIR() method is the one most commonly used now.

    Excel cannot change "format" of a text file, it would have to be opened in Excel and during the "open" you would set the parameters for that column B. Turn on the macro recorder and let it record you opening one of those text files, fixing the column format as you import. If you still need to format column B, do that, then save the file back as a text file.

    Post all the code that results from that, then we'll take a look.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    03-20-2012
    Location
    Dunedin NZ
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Repeat macro for every file in the folder.

    Ok. Thats what I did, but somehow it does not record when I am opening files in excel... How can I do that?

    Please Login or Register  to view this content.
    Thanks heaps!!!

  6. #6
    Registered User
    Join Date
    03-20-2012
    Location
    Dunedin NZ
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Repeat macro for every file in the folder.

    By the way, I have a mac os x 10.6.8 and Excel 2011

+ 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