Robb or anyone
Posted by RoB on October 04, 2001 12:50 PM
This is the code you gave me to extract data from all excel files in a directory:
Sub Dtry()
Dim myFile As String, myCurrFile As String
myCurrFile = ThisWorkbook.Name
myFile = Dir("E:\Whatever Path\*.xls")
Do Until myFile = ""
Workbooks.Open "E:\Whatever Path\" & myFile
Workbooks(myCurrFile).Worksheets("Sheet1").Range("A1").End(xlDown).Offset(1,0) = Workbooks(myFile).Worksheets("Application").Range("J8")
Workbooks(myFile).Close savechanges:=False
myFile = Dir
Loop
End Sub
I put the code in, but there is an error with this line:
Workbooks(myCurrFile).Worksheets("Sheet1").Range("A1").End(xlDown).Offset(1,0) = Workbooks(myFile).Worksheets("Application").Range("J8")
Its something to do with the .End(xlDown).Offset(1,0)part of the line.
I've tried playing with it, but cant figure out whats wrong.
Thanks for any help :)