Hi all,
In Sheet1 column A, I have listed all the files that can be found in "C:\Documents\"
Then I have the following code:
That code renames the files by adding a string (1000 + k*10) to the filename.
This code works well, except if one of the files are in format other than TIF. The only other format in the folder is PDF, so it could only either be TIF or PDF.
So my question is,. how do I change above in such a way that it should just use whatever is the file extention of the file in the folder?
Thanks in advance.
In Sheet1 column A, I have listed all the files that can be found in "C:\Documents\"
Then I have the following code:
Code:
Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
ToPath = "C:\Documents\"
For k = 1 To x
On Error Resume Next
Name ToPath & Sheets("Sheet1").Cells(k, 1).Value & ".TIF" As ToPath & 1000 + k * 10 & " " & Sheets("Sheet1").Cells(k, 1).Value & ".TIF"
Next k
That code renames the files by adding a string (1000 + k*10) to the filename.
This code works well, except if one of the files are in format other than TIF. The only other format in the folder is PDF, so it could only either be TIF or PDF.
So my question is,. how do I change above in such a way that it should just use whatever is the file extention of the file in the folder?
Thanks in advance.