+ Reply to Thread
Results 1 to 7 of 7

VBA Macros to Rename Sub Folder with ID

  1. #1
    Forum Contributor
    Join Date
    02-04-2015
    Location
    India
    MS-Off Ver
    365 (2202)
    Posts
    226

    VBA Macros to Rename Sub Folder with ID

    Hello Excel Experts,

    I have a requirement to rename the Sub folder with the ID No.

    For e.g.

    I have a Folder Name - Corporate

    Into Corporate Folder there are multiple folders. For e.g. :

    790 Name of Employee
    791 Name of Employee
    795 Name of Employee
    805 Name of Employee

    And into each folders there are 3 folders i.e.

    INCOMING
    OUTGOING
    RECEIVING

    My requirement is :

    Before every folder name, the ID should appear of that particular folder / renamed as below :

    790 INCOMING
    790 OUTGOING
    790 RECEIVING

    Similarly,

    The folders into "791 Name of Employee" should be renamed to :

    791 INCOMING
    791 OUTGOING
    791 RECEIVING

    There are hundreds of folder which I need to rename as described above, so looking for a VBA Macro.

    Thanks for your help !

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Macros to Rename Sub Folder with ID

    Try this:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Contributor
    Join Date
    02-04-2015
    Location
    India
    MS-Off Ver
    365 (2202)
    Posts
    226

    Re: VBA Macros to Rename Sub Folder with ID

    Hi,

    Thanks! The above VBA code worked for me.

    But I didn't mentioned one more requirement in my first thread.

    As in the code provided, you mentioned to make changes in the folder path as necessary. This code gave me an output to rename the folders into Corporate Folder.

    But there are still 5 more folders. Say for e.g. Folder 2, Folder 3, Folder 4, Folder 5 and Folder 6.

    So once the folder names are changed into Corporate Folder, then there should be a loop to go to Folder 2 and rename all the 3 folders , then Folder 3, 4, 5 and 6.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Macros to Rename Sub Folder with ID

    Not sure I understand. Can't you just edit the folder location at the top of the macro and re-run it?

    WBD

  5. #5
    Forum Contributor
    Join Date
    02-04-2015
    Location
    India
    MS-Off Ver
    365 (2202)
    Posts
    226

    Re: VBA Macros to Rename Sub Folder with ID

    Yes. I did changed the folder location but that updated for Corporate folder (INCOMING, OUTGOING, RECEIVING were renamed)

    There are still 5 other folders just like Corporate, into which we have INCOMING, OUTGOING, RECEIVING folders.

    Say for e.g. I still have Folder 2, Folder 3, Folder 4, Folder 5 and Folder 6.

    So once the folders into Corporate is renamed, macro should go to Folder 2, rename the INCOMING, OUTGOING, RECEIVING folders and then go to Folder 3 rename the INCOMING, OUTGOING, RECEIVING folders. Then Folder 4, 5 and 6 (or till the last folder).

  6. #6
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Macros to Rename Sub Folder with ID

    Small tweak then:

    Please Login or Register  to view this content.
    WBD

  7. #7
    Forum Contributor
    Join Date
    02-04-2015
    Location
    India
    MS-Off Ver
    365 (2202)
    Posts
    226

    Re: VBA Macros to Rename Sub Folder with ID

    Hi,

    Thanks! This worked for me.

+ 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. rename files in folder
    By anilg0001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2014, 08:22 AM
  2. [SOLVED] Rename each file in the folder
    By Aquamore in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2013, 03:51 PM
  3. Macros Open folder, copy, paste and close the folder
    By hahahahahahaha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2013, 05:03 PM
  4. Replies: 1
    Last Post: 03-12-2013, 04:45 AM
  5. [SOLVED] Rename Files in A folder
    By pradeepjassal in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-12-2012, 10:36 AM
  6. rename files in a folder
    By Varun Nair in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-18-2006, 08:25 AM
  7. rename all files in a folder
    By DIBS in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2006, 02:50 AM

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