After executing the code below, it is requested to define the path of the files through a dialog box. However, I need to replace this behavior, to make the file path predefined by me, instead of requesting the target folder manually.
VBA Code:
Sub RenameFiles_A()
Dim xDir As String
Dim xFile As String
Dim xRow As Long
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
xDir = .SelectedItems(1)
xFile = Dir(xDir & Application.PathSeparator & "*")
Do Until xFile = ""
xRow = 0
On Error Resume Next
xRow = Application.Match(xFile, Range("A:A"), 0)
If xRow > 0 Then
Name xDir & Application.PathSeparator & xFile As xDir & Application.PathSeparator & Cells(xRow, "C").Value
End If
xFile = Dir
Loop
End If
End With
End Sub