Hi Experts,
I have the code below that would list Folder Names in my Excel and this is the Step 1 that I want, it's working will;
Step 2 I need a code to rename the folder name base on what I have assigned in corresponding Column C rows? I've tried to find any related threads but I was not lucky to find one.
AdditionalNo action needed if one of the rows in Column C is blank?
Please anyone is kind to help me figure out the code would be?
Thanks in advance,
12Rev79
I have the code below that would list Folder Names in my Excel and this is the Step 1 that I want, it's working will;
VBA Code:
Dim objFSO As Object
Dim objFolders As Object
Dim objFolder As Object
Dim strDirectory As String
Dim arrFolders() As String
Dim FolderCount As Long
Dim FolderIndex As Long
Range("B5").Offset(1, 0).Select
Range(Selection, Selection.End(xlDown)).ClearContents
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Select Folder : Denver"
.Show
If .SelectedItems.Count = 0 Then
Exit Sub
End If
strDirectory = .SelectedItems(1)
End With
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolders = objFSO.GetFolder(strDirectory).SubFolders
FolderCount = objFolders.Count
If FolderCount > 0 Then
ReDim arrFolders(1 To FolderCount)
FolderIndex = 0
For Each objFolder In objFolders
FolderIndex = FolderIndex + 1
arrFolders(FolderIndex) = objFolder.Name
Next objFolder
Worksheets("Rename_ver2").Range("B6").Resize(FolderCount).Value = Application.Transpose(arrFolders)
Else
MsgBox "No folders found in the Selected directory!", vbExclamation
End If
Set objFSO = Nothing
Set objFolders = Nothing
Set objFolder = Nothing
Step 2 I need a code to rename the folder name base on what I have assigned in corresponding Column C rows? I've tried to find any related threads but I was not lucky to find one.
AdditionalNo action needed if one of the rows in Column C is blank?
Please anyone is kind to help me figure out the code would be?
Thanks in advance,
12Rev79
Last edited by a moderator: