PDA

View Full Version : move files from one folder to another whose file names are listed in an excel file



stefanoste78
04-24-2019, 05:18 AM
Good evening.


If in a folder I have pdf files: 1,2,3,4,5,6,7,8,9,10


I would like to move some of these files to another folder in the order shown in an excel column:


eg:


3
6
8
10


Is it possible to do this with a macro?


Thank you

Bob Phillips
04-24-2019, 10:50 AM
Which go to folder 3, which to 6, and so on?

大灰狼1976
04-24-2019, 07:42 PM
Hi stefanoste78!
Suppose 3, 6, 8, 10 are in A1:A4 cells.

Sub Test()
Dim i&, oldpath$, newpath$
oldpath = "???????\" 'Input as needed
newpath = "???????\" 'Input as needed
For i = 1 To 4
Name oldpath & Cells(i, 1) & ".pdf" As newpath & Cells(i, 1) & ".pdf"
Next i
End Sub