+ Reply to Thread
Results 1 to 3 of 3

looping through files in a folder

  1. #1
    Registered User
    Join Date
    01-27-2010
    Location
    prague
    MS-Off Ver
    Excel 2010
    Posts
    52

    looping through files in a folder

    hi,

    i am trying to loop through all files in a folder (each file being labelled MyFile), copy a chunk of stuff from each MyFile, paste that onto another file ("main.xlsx"), then copy a cell from MyFile to rename the particular worksheet in main.xlsx. i have found a useful chunk of code to loop through all files in a folder at http://mariaevert.dk/vba/?p=99, and have modified it slightly, to get:

    Please Login or Register  to view this content.
    there are 2 errors in this code that i do not know how to correct:

    1. Windows(MyFile).Activate
    can someone pls show me how to activate MyFile again within the loop?

    2. Sheets("Sheet" & i).Name = C4
    i would like to rename the activesheet in main.xlsx to the text that is in C4 in MyFile; how do i do that?

    thanks for any help!

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: looping through files in a folder

    Please Login or Register  to view this content.
    But you have to add sheets, otherwise they end up
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    01-27-2010
    Location
    prague
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: looping through files in a folder

    hi there thanks for your help. will try it out!

+ 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