Copy a list of files

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.

  1. Public Sub CopyFiles()
  2.     Dim CurrentPath, ToPath, i, LastRow
  4.     CurrentPath = "C:\"
  5.     ToPath = "C:\temp\"
  7.     LastRow = Range("A" & rows.Count).End(xlUp).Row 'provided the list of file is in col A
  9.     For i = 1 To LastRow 'provided there's no header
  10.        FileCopy CurrentPath & Cells(i, 1).Value, ToPath & Cells(i, 1).Value
  11.     Next i
  12. End Sub

You can use the PickFileOrFolder function, from here, to browse for the path.

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.