+ Reply to Thread
Results 1 to 14 of 14

VBA change folder names from list excel

  1. #1
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    VBA change folder names from list excel

    Hi,

    Is it possible to change folder names with VBA, I have 600+ to change

    I want to add a prefix to the current name

    Thanks
    Kevin
    Last edited by Excelski; 11-01-2019 at 03:24 AM. Reason: more descriptive title

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Change folder names

    Yes, it's possible. This came up first in a Google search: https://stackoverflow.com/questions/...older-renaming

    This might also help: https://www.howtoexcel.org/vba/how-t...s-from-a-list/
    Last edited by AliGW; 11-01-2019 at 02:54 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Change folder names

    Thank you Ali, I will try it.
    I did google it first but didn't see that!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Change folder names

    What did you Google??? I simply typed "VBA change folder names".

  5. #5
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Change folder names

    I failed to mention VBA!
    That said, I think this is above my sill level.

    I was hoping to be able to list the old and new folder names in excel and pint at the location...….wishful thinking

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Change folder names

    You could look here: http://www.vbforums.com/showthread.p...ough-excel-vba

    Google search: "VBA change folder names from list excel".

    I suggest you update this thread's title to include the list requirement. Also, explain more about the change that you want to make - is it a prefix you wish to add or change? Are the folders in question all within one directory?
    Last edited by AliGW; 11-01-2019 at 03:17 AM.

  7. #7
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Change folder names

    Thanks again.

    How do I update title?

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: Change folder names

    Edit your opening post and change it.

  9. #9
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: Change folder names

    Title changed

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: VBA change folder names from list excel

    That's better - let's see what the VBA experts say. In the meantime, provide the following:

    1. Examples of folder names that you want to change, e.g. from XYZ-folder to ABC-folder.
    2. Where the folders are (directory, e.g. C:\Users\Exelski\Documents\Stuff).

  11. #11
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: VBA change folder names from list excel

    Okay Thanks

    Currently the folder names are descriptions of physical locations, eg 3rd floor east elevation. I want to prefix all folders with KJC 001, KJC 002 etc. The example becomes KJC 001 3rd floor east elevation
    Directory is C:\Users\kevin.xxxx\Documents\Locations\

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA change folder names from list excel

    Let's start with this.

    The code extracts all foldernames from basefldr and lists them in Column A.

    It then adds the prefix to the foldernames (Column B)

    After that it starts renaming all foldernames according to names in Column B.
    Please Login or Register  to view this content.
    Try this first on a directory with only a few folders in it to test.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  13. #13
    Forum Contributor
    Join Date
    05-30-2015
    Location
    Dubai
    MS-Off Ver
    Excel 2016 Mac & PC & 365
    Posts
    633

    Re: VBA change folder names from list excel

    Hi barkerman,

    It worked like a charm
    Thank you!!

    Kevin

  14. #14
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: VBA change folder names from list excel

    you're welcome and thanks for rep+.

+ 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. [SOLVED] Change files names in a folder
    By billj in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-06-2019, 11:48 AM
  2. [SOLVED] change code to get folder names instead of files
    By Ramoi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2018, 08:17 AM
  3. [SOLVED] Loop Through Folder, Create Emails with Sub Folder Names in Subject, Attach files in sub
    By Rschwar23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2015, 10:06 AM
  4. Change the workbook names in the new folder through code
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-12-2013, 08:32 AM
  5. Import TXT files from a specific folder into Excel - TXT file names change hourly
    By jeepinjeff in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2013, 04:08 AM
  6. [SOLVED] Change file names in a folder
    By TISR in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-12-2006, 08:40 AM
  7. [SOLVED] Change names of Files in a folder
    By TISR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2006, 05:45 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