amitcohen
Board Regular
- Joined
- Jan 14, 2010
- Messages
- 118
Hi Guys
Hope you van help me fix the error here
The following macro forcing a file name change
In Column A There is a list of files stored in a folder: change_names.
(All files are in CSV format.)
In Column B there is a list on new name for each file.
This macro should force the change, but from some reasons,
it pops-up a run time error 53.. File Not Found
And the debug highlight the red line.
What am I missing here?
Thanks for help!
Amit
Hope you van help me fix the error here
The following macro forcing a file name change
In Column A There is a list of files stored in a folder: change_names.
(All files are in CSV format.)
In Column B there is a list on new name for each file.
This macro should force the change, but from some reasons,
it pops-up a run time error 53.. File Not Found
And the debug highlight the red line.
Code:
Sub ReNameFiles1()
Dim path As String, filespec As String
Dim CurrentName As String, NewName As String
path = "C:\Users\WEB\Desktop\change_names" ' your path
For i = 1 To 100 ' your range
Range("A1").Value = Range("A" & i).Value
Range("B1").Value = Range("B" & i).Value
CurrentName = Range("A1").Value
NewName = Range("B1").Value
[COLOR=Red]Name path & CurrentName As path & NewName & ".csv"[/COLOR]
Next i
End Sub
Thanks for help!
Amit