I have a sheet that contains 3 cell values (screenshot below), which I want to be used to rename the files. This macro I found initially had only 2 values, and the path was included on both of these cell values. I want the path to be listed in a separate line, it will, of course be the same for both.
Cell C2 - Path (for BOTH files)
Cell C4 - Existing Filename
Cell C6 - Rename to
Name ActiveSheet.Range("C4") As _
ActiveSheet.Range("C6")
End Sub
Sub VBARenameFileSheetNames()
'* Sytax is: FileCopy sourceFullName, newFileName
FileCopy ActiveSheet.Range("C2") & ActiveSheet.Range("C4") , ActiveSheet.Range("C2") & ActiveSheet.Range("C6")
Kill FileCopy ActiveSheet.Range("C2") & ActiveSheet.Range("C4")
End Sub
Make sure that the file path contains the final backslash
You will have to add check if target file is not already present and if the sourcefile is present
You can add the path in:
Name ActiveSheet.Range("C2") & ActiveSheet.Range("C4") As _
ActiveSheet.Range("C2") & ActiveSheet.Range("C6")
@Velouria,
That works perfectly! I knew the answer was simple, but every attempt I made mailed. Thanks so very much for your help!!!!