Hello,
Thanks for your response.
Where do I insert your code?
I tried the code below but could not get it to work:
Function GetFolder() As String
Dim fldr As FileDialog
Dim sItem As String
Dim strPath As String
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = Application.DefaultFilePath
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
' Set fldr = Nothing
strPath = Left(sItem, InStrRev(sItem, "\") - 1)
strPath = filesys.BuildPath(strPath, "Copy1")
' Create the folder "Copy1"
filesys.CopyFolder sItem, strPath
End Function
Sub RenameFile()
Dim z As String
Dim s As String
Dim V As Integer
Dim TotalRow As Integer
TotalRow = ActiveSheet.UsedRange.Rows.Count
For V = 1 To TotalRow
' Get value of each row in columns 1 start at row 2
z = Cells(V + 1, 1).Value
' Get value of each row in columns 2 start at row 2
s = Cells(V + 1, 2).Value
Dim sOldPathName As String
sOldPathName = z
On Error Resume Next
Name sOldPathName As s
Next V
MsgBox "Congratulations! You have successfully renamed all the files"
End Sub
Bookmarks