• Ask a Question
Insert Image Size must be less than < 5MB.
    Ask a Question
    More answer You can create 5 answer(s).
      Ask a Poll
      Top Contributor

      Rename all folders in a root folder

      HI Team,

      I want help to rename all folders in a root folder with different name using VBA. So that one button click it should happen. In Excel I have all existing folder names in one column and new folder names in another column.  Appreciate your help here.



      Asked by Lora on September 13, 2017 in VBA: Files & Folders.
      1 Answers

      Hi Lora,

      Here is the vba code to rename all folders in root folder form existing name to new name.  The below code will loop through all folder names and will update new name.

      Sub ReName_Folders()
      Const sRootFolder As String = "C:\Users\IBM_ADMIN\Desktop\3QWk10\SubBrand Integration\"
      Dim Old_FolderName As String, New_FolderName As String
      With Sheets("Settings")
      For i = 2 To .Range("AE1").End(xlDown).Row
      Old_FolderName = sRootFolder & Sheets("Settings").Range("AE" & i)
      New_FolderName = sRootFolder & Sheets("Settings").Range("AF" & i)
      Name Old_FolderName As New_FolderName
      Next i
      End With
      End Sub

      Hope it resolves your requirement




      Answered by Valli on September 14, 2017..