Importing multiple files

T

Tommy

I need to import financial data from 251 days, and wondered if there is a
script or method that I can use to do this, so that I dont have to repeat
"import external data" 250 times?
 
T

Tom Ogilvy

sub Get Data()
Dim bk as workbook
Dim sPath as String, i as long
Dim sName as String
sPath = "C:\Myfiles\"

sName = Dir(sPath & "*.xls")
do while sName <> ""
set bk = Workbooks.Open( Filename:=sPath & sName)
bk.Worksheets(1).Range("A1").CurrentRegion.Copy _
Destination:=ThisWorkbook.Worksheets(1)
.cells(rows.count,1).End(xlup)(2)
bk.Close Savechanges:=False
sName = dir()
Loop
end sub
 
Top