I use 'FileCopy Source:=' and 'Destination:=' functions to copy files named in cell (column B) from folders named in cell (column A) to another folders named in another cell (column C) which I want to rename them (named in column D).
</PRE>
But...when I want to delete all files inside the folders named in column C before I copy files from column B in folders named column A. I tried using 'Kill' --> FileKill Source:=, Kill Source:=, Kill:=, etc... none of these seem like correct functions. Anyone could help?
HTML:
Sub Copy_Files()
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
n = Selection.End(xlDown).Row
For i = 2 To n
FileCopy Source:=Cells(i, 1).Value & Cells(i, 2).Value, _
Destination:=Cells(i, 3).Value & Cells(i, 4).Value
Next i
MsgBox "File copy complete."
End Sub
But...when I want to delete all files inside the folders named in column C before I copy files from column B in folders named column A. I tried using 'Kill' --> FileKill Source:=, Kill Source:=, Kill:=, etc... none of these seem like correct functions. Anyone could help?