Hello! First time for me to post!! I'm a self taught Macro maker so have patience please.
I am trying to create a macro to move files from one folder to another. I've tried reading and working off other macros I found on here but cant get it to work.
I have an excel sheet with a column of Vendors.
The folder I have will say something like "Bulk 5227834" and there will be up to 70 files with different numbers. I need all of the bulk to move from that folder to the vendor folder. additionally it can either be a PDF or an excel.
I have created a dummy folder to try and do this.
this is the code I have. (It doesn't work) but even if it did, I need the macro to look through the list of vendors, theres too many to write a code line for each.
any help will be greatly appreciated!
I am trying to create a macro to move files from one folder to another. I've tried reading and working off other macros I found on here but cant get it to work.
I have an excel sheet with a column of Vendors.
The folder I have will say something like "Bulk 5227834" and there will be up to 70 files with different numbers. I need all of the bulk to move from that folder to the vendor folder. additionally it can either be a PDF or an excel.
I have created a dummy folder to try and do this.
this is the code I have. (It doesn't work) but even if it did, I need the macro to look through the list of vendors, theres too many to write a code line for each.
Code:
Dim d As String, ext, x
Dim FSO As Object
Dim FromDir As String
Dim ToDir As String
Dim FExtension As String
Dim FNames As String
Dim Files As String
Dim LR As Long
LR = Sheets("Macro").Range("A" & Rows.Count).End(xlUp).Row
For RW = 2 To LR
Dim srcPath As String, destPath As String, srcFile As String
srcPath = "H:\Annie\delete\"
destPath = "H:\Annie\delete2\"
ext = Array("19", "April")
For Each x In ext
d = Dir(srcPath & x)
Do While d <> ""
srcFile = srcPath & d
FSO.MoveFile , destPath & d
d = Dir
Loop
Next
End Sub
any help will be greatly appreciated!