ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Importing multiple files (https://www.excelbanter.com/excel-discussion-misc-queries/131256-re-importing-multiple-files.html)

joel

Importing multiple files
 
You need to write you own VBA excel macro

It wuld look somethin like this

sub Get Data()
PrefixFileName = "PrefixFilename"
for i = 1 to 251

MyfileName = Prefixfilename + Cstring(i) ' converts integer i to a string
Workbooks.Open Filename:=MyfileName, ReadOnly:=True
' Removed pathname from file name so it can be referenced in this program.
'Basic doesn't like the full pathname???? stupid microsoft
Do While (1)
CharPosition = InStr(MyfileName, "\")
If CharPosition 0 Then
MyfileName = Mid(MyfileName, CharPosition + 1)
Else
Exit Do
End If
Loop
Cells("A1").Copy _
Destination:=Workbooks(MyWorkbook).Worksheets
(MyWorksheetName). _
Range("F2"). _
Offset(rowOffset:=0, columnOffset:=0)
Next i
end sub
"Tommy" wrote:

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?



All times are GMT +1. The time now is 07:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com