я хочу переименовать файлы на основе значения ячейки я нашел Runtime Ошибка 1004

Sub Rename_Files()
  Dim FSO
  Dim RFP As String        'Rename Folder Path
  Dim lstrow As Long
  Dim i As Long
      lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
      For i = 2 To lstrow

  'renaming folder locations
   RFP = Range("F", i)       'Rename Folder Path

      Set FSO = CreateObject("Scripting.FileSystemObject")

         FSO.GetFile(Range("M2")).Name = Range("G", i)   'M2 is a Renaming File name and G is a new file name means what we want to change in the dir

    Next
End Sub

0