Hi John
If you copy the web address to clipboard, then in excel select File
Open, and paste the address in:
http://www.federalreserve.gov/releases/h10/Summary/indexnc_m.txt
Excel will open the file directly. It is easiest to select fixed width
then delete to column break that excel tries to insert between th
month and year by clicking on that line at screen 2 of the text t
columns wizard. This should automatically give you proper date format
in the 1st column.
Incidentally, are you sure this isn't available as an excel file? S
louis fed has an excellent range of data in excel format. If like m
you're an economic data junkie, you may find this macro useful, which
use to import a wide range of from the st lois fed site.
I store these sheets in a a workbook that also charts them, but its to
big to post here. Let me know if you'd like it e-mailed (its 1.4M
tho)
If you run this code, I'd also recomment using a shorter array of fil
names to download at first (2 ior 3 files), just to check it for spee
and errors.
Sub download_fred_files()
Application.DisplayAlerts = False 'turn alerts off
page_names = Array("cdsp", "hsn1f", "houst", "indpro", "isratio"
"mfgoph", "mich", "napm", "neworder", "rsafs", "rrsfs", "tcu"
"umcsent", "afcedef", "afdef", "afexpnd", "afrecpt", "dgic96", "fpic1"
"gdpc1", "cpiaucsl", "ce16ov", "emratio", "helpwant", "payems", "pop"
"unrate", "bopbca", "bopbgs")
file_path = "
http://research.stlouisfed.org/fred2/series/"
file_extension = ".xls"
this_workbook_name = ActiveWorkbook.Name
error_message = ""
For n = 0 To UBound(page_names)
file_to_copy = file_path & page_names(n) & "/downloaddata/"
page_names(n) & file_extension
'MsgBox file_to_copy
On Error Resume Next 'do not stop macro if file not found
SN = ActiveWorkbook.Sheets.Count - 1
Workbooks.Open Filename:=file_to_copy
If Error <> "" Then error_message = error_message & Chr(10)
Error
'If Error = "" Then error_message = error_message & Chr(10)
Error
If Error = "" Then
fnc = ActiveWorkbook.Name
ActiveSheet.Name = page_names(n) 'names the sheet with th
workbook name
ActiveSheet.Cop
After:=Workbooks(this_workbook_name).Sheets(SN) 'copies to new sheet a
end of workbook
Windows(fnc).Close
Else
error_message = error_message & Chr(10) & page_names(n) &
file not found!!" 'identifies missing files
End If
Next 'next file
If error_message <> "" Then MsgBox error_message
Application.DisplayAlerts = True 'turn alerts back on
End Su