I'm very new to VBA and have been messing around with a few codes for work. Essentially, I have a folder that contains 1000+ folders with different names--and I need to rename each folder. I have an excel sheet set up with the Original File Path, Old Folder name, and Desired Folder Name. I have found that this code works for the parent folder, but not the folders within it:
Sub rename_folder()
Dim old_name, new_name As String
For i = 2 To Sheets(1).Range("a1").End(xlDown).Row
new_name = Left(Sheets(1).Cells(i, 1).Value, Len(Sheets(1).Cells(i, 1).Value) - Len(Sheets(1).Cells(i, 2).Value))
new_name = new_name & Sheets(1).Cells(i, 3).Value
old_name = Sheets(1).Cells(i, 1).Value
Name old_name As new_name
Next i
End Sub
How do I get it so that this code renames all the folders within the parent folder? Any help would be much appreciated! Thanks.