Hallo Sonja,
hab mal ein bischen aufgeräumt, sollte aber noch genau das tun was es vorher getan hat, teste das bitte einmal und melde dich dann, dann kann mann es noch umbauen.
Und, eine Frage in welche Datei sollen die Spalten geschrieben werden?
Sub opencsvrff()
Pfad = "K:\OE0969\Users\Mazanec\Projekte\01_Bond Risk Premia in R\03_FIN\"
rff_csv = Pfad & "rff_out.csv"
rxm_csv = Pfad & "REM.csv"
rff_xls = Pfad & "rff_out.xls"
rxm_xls = Pfad & "REM.xls"
Set rff = Workbooks.Open Filename:=rff_csv
Set rxm = Workbooks.Open Filename:=rxm_csv
rff.SaveAs Filename:=rff_xls, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
rff.Close
rxm.SaveAs Filename:=rxm.xls, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
rxm.Close
Set rff = Workbooks.Open Filename:= rff_xls
With rff
.Cells.Select
.Selection.Copy
Windows("FutOverlay_Main_FRP.xlsm").Activate
.Sheets("RFF").Select
.Cells.Select
ActiveSheet.Paste
Windows("rff_out.xls").Activate
.Close
End With
Set rxm = Workbooks.Open Filename:= rxm_xls
With rxm
.Cells.Select
.Selection.Copy
Windows("FutOverlay_Main_FRP.xlsm").Activate
.Sheets("REM").Select
.Cells.Select
ActiveSheet.Paste
.Save
Windows("REM.xls").Activate
.Close
End With
'(c) J13J5UB 190612, 111012
End Sub
Gruß Detlev
|