Tested in Excel 365 (16.8730.2046) 64-bit. Links open in new tab.
Useful when you want to separate a list of files mingled with others in the same folder.
- Public Sub CopyFiles()
- Dim CurrentPath, ToPath, i, LastRow
- CurrentPath = "C:\"
- ToPath = "C:\temp\"
- LastRow = Range("A" & rows.Count).End(xlUp).Row 'provided the list of file is in col A
- For i = 1 To LastRow 'provided there's no header
- FileCopy CurrentPath & Cells(i, 1).Value, ToPath & Cells(i, 1).Value
- Next i
- End Sub
You can use the PickFileOrFolder function, from here, to browse for the path.