Public Sub RenameFiles() Dim fso As Scripting.FileSystemObject Dim vFiles As Variant Dim i As Long Dim oFile As Scripting.File Dim sFilePath As String Const cFILE_PATH As String = "C:\Temp" Set fso = New Scripting.FileSystemObject vFiles = ActiveSheet.Cells(1).CurrentRegion.Value For i = 1 To UBound(vFiles, 1) With fso sFilePath = .BuildPath(cFILE_PATH, vFiles(i, 1)) If .FileExists(sFilePath) Then Set oFile = .GetFile(sFilePath) oFile.Name = vFiles(i, 2) End If End With Next i End Sub
|need summation of cells of the same row having same column difference between the two cells||6||34|
|ms office troubleshooting for users||8||35|
|Excel: Find text between 2nd hyphen and next space||10||30|
|Converting An Excel IF statement formula to VBA||10||12|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
22 Experts available now in Live!