(Solved) – Copy Data from Multiple Workbook to main file

  • by

I have this formula and Im getting Error 1004, saying that file was possible removed or renamed or deleted, but in reality file is just there.

Im getting the error on this line : Workbooks.Open (MyFile)

Sub LoopThroughDirectory()
Dim MyFile As String 
Dim erow MyFile = Dir("C:Userscongresojr.5DesktopPuller Samplesample file")

Do While Len(MyFile) > 0
If MyFile = "zzzPuller.xlsm" Then
Exit Sub
End If

Workbooks.Open (MyFile) Range("B11:J31").Copy ActiveWorkbook.Close

erow = RawPuller.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Destination:=Worksheets("RawPuller").Range(Cells(erow, 2),
Cells(erow, 10))

MyFile = Dir


End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *