Ok So I have list in excel, column A.The list corresponds to file names in a folder on my desktop, I want the VBA to find the names in column A in my folder and move those files to another folder.
Example is in A1 the file name is "ZAC". On my desktop is a folder called Cousins. The file ZAC is in that folder. I want the code to move ZAC to a new folder called EX Cousins.
I found this code below that is suppose to work but I do not know where to put the path names to the folders.
I hope I have the code tags right.
[pre]
[/pre]
Example is in A1 the file name is "ZAC". On my desktop is a folder called Cousins. The file ZAC is in that folder. I want the code to move ZAC to a new folder called EX Cousins.
I found this code below that is suppose to work but I do not know where to put the path names to the folders.
I hope I have the code tags right.
[pre]
Code:
Sub MoveFiles()
Dim Cell As Range
Dim Filename As String
Dim Filepath As String
Dim NewPath As String
Dim Rng As Range
Dim RngEnd As Range
Dim Wks As Worksheet
Set Wks = ActiveSheet
Set Rng = Wks.Range("A1")
Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Wks.Range(Rng, RngEnd)
For Each Cell In Rng
Filename = Cell
Filepath = Cell.Offset(0, 1)
NewPath = Cell.Offset(0, 2)
Name Filepath & "" & Filename As NewPath & "" & Filename
Next Cell
End Sub