hi,
I'm not quite sure how to make this work (I think I'm close).
The paths to the files are stored in cells in Column B.
I would like to loop through each row and grab the path and copy the file.
So far this is what I have:
But it keeps saying "Method Range of worksheet failed" on this line:
For Each x In Range("B2:B")
What am I doing wrong?
Thanks in advance,
cs
I'm not quite sure how to make this work (I think I'm close).
The paths to the files are stored in cells in Column B.
I would like to loop through each row and grab the path and copy the file.
So far this is what I have:
Code:
Dim fso As Object
Dim cPath, nPath As String
Dim x As Range
nPath = Worksheets("Sheet1").Range("C2").Value
Set fso = CreateObject("Scripting.FileSystemObject")
Application.Goto ThisWorkbook.Sheets(1).Range("B2")
For Each x In Range("B2:B")
fso.CopyFile x.Value & "*.pdf", nPath
Next x
Set fso = Nothing
But it keeps saying "Method Range of worksheet failed" on this line:
For Each x In Range("B2:B")
What am I doing wrong?
Thanks in advance,
cs