djgenesis13
New Member
- Joined
- Apr 24, 2014
- Messages
- 22
Hello,
I have been searching the forum for this and I can not find anything that does the job. The case is rather simple though.
I have a folder full of pictures (about 10000). I also have an excel file where in one sheet I have some filenames (without path) in a range of cells - not in one column only, the filenames are in a continuous range of cells and specifically in range AZ:BU (22 columns). This range has also got some empty cells and a header row. an exaple of a cell value is
<tbody>
</tbody>I want to search a specific folder in my pc, find only the files in the range mentioned above and copy them to another specific folder. I have tried a sub found in the forum but I just keep getting errors '76' path not found
Sub Copy_Files()
oldpath = "C:\oldfolder\"
newpath = "C:\newfolder\"
For Each r In Range("az2", Range("bu" & Rows.Count).End(xlUp))
fn = Dir(oldpath & r)
If fn <> "" Then
FileCopy oldpath & r, newpath & r
End If
Next
End Sub
Thanks in advance
I have been searching the forum for this and I can not find anything that does the job. The case is rather simple though.
I have a folder full of pictures (about 10000). I also have an excel file where in one sheet I have some filenames (without path) in a range of cells - not in one column only, the filenames are in a continuous range of cells and specifically in range AZ:BU (22 columns). This range has also got some empty cells and a header row. an exaple of a cell value is
"Baby_Monitor_with_Two_Way_Audio_Main.jpg". |
<tbody>
</tbody>
Sub Copy_Files()
oldpath = "C:\oldfolder\"
newpath = "C:\newfolder\"
For Each r In Range("az2", Range("bu" & Rows.Count).End(xlUp))
fn = Dir(oldpath & r)
If fn <> "" Then
FileCopy oldpath & r, newpath & r
End If
Next
End Sub
Thanks in advance