+ Reply to Thread
Results 1 to 4 of 4

Renaming Folders in a macro but so far all I can do is loop thru the folder.

  1. #1
    Registered User
    Join Date
    07-02-2013
    Location
    nashville, tn.
    MS-Off Ver
    Excel 2013
    Posts
    13

    Renaming Folders in a macro but so far all I can do is loop thru the folder.

    Hello and thanks for any and all help.

    I have a folder that has several thousand subfolders that I need to rename. I ran a macro that listed all the names of the folders and put it into an excel sheet. I then got all the unique names that the folders need to be renamed to and it looks like this:
    Please Login or Register  to view this content.
    I looked for how to loop thru my folder "test" to read each subfolder (#1, #2, #3 and so on ) and was trying to figure out how to then compare that the subfolder that just got looped was the same as say A1. ie if loopedsubfolder = A1 then rename subfolder B1.


    Now the code I got will tell me if the loop is A1 but then will not let me Name to B1 error 51 file not found

    I created a test folder with 3 subfolders on my desktop to figure this out and if anyone can take a look at my code that would be great.

    Please Login or Register  to view this content.
    Thanks
    Joe
    Attached Files Attached Files
    Last edited by jody1234; 07-03-2013 at 02:02 AM. Reason: Solved

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Renaming Folders in a macro but so far all I can do is loop thru the folder.

    Put this is a standard code module.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-02-2013
    Location
    nashville, tn.
    MS-Off Ver
    Excel 2013
    Posts
    13

    Re: Renaming Folders in a macro but so far all I can do is loop thru the folder.

    I called the procedure and got an error of file not found.

    I thought, darn didn't work but then I checked my test folder and it changed all the folder names so you rock, roll, and well thanks a lot.

    I will post this as resolved.

    Thanks again.

    Joe

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Renaming Folders in a macro but so far all I can do is loop thru the folder.

    If you got a file not found error, it means one folder listed in column A could not be found. The folders following that would not be renamed as well because the code stopped. Perhaps it was the last value in column A?

+ 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