Robb or anyone :) Macro Question
Posted by RoB on October 08, 2001 10:31 AM
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).Activate
Workbooks(myCurrFile).Worksheets("Sheet1").Range("A65536").End(xlUp).Activate
With ActiveCell
.Offset(1, 0) = Workbooks(myFile).Worksheets("Application").Range("AI4")
End With
Workbooks(myFile).Close savechanges:=False
myFile = Dir
Loop
End Sub
It works great, but I was wondering, if I have other directories in this directory, is there a way to get the data from ALL the sub directories in this main one automatically? or maybe with a mod? Thanks