Hello,
I am trying to automate some data importing into a spreadsheet from another then save as a new file name.
When I go through the macro it all works right up to the point it trys to save the spreadsheet.
I just get the run time error 424: Object required
I am sure I must be missing something but unsure as to what?
Please could someone assist?
I am trying to automate some data importing into a spreadsheet from another then save as a new file name.
When I go through the macro it all works right up to the point it trys to save the spreadsheet.
I just get the run time error 424: Object required
I am sure I must be missing something but unsure as to what?
Please could someone assist?
Code:
Sub CopyDate()
Dim inputdata As String
Dim outputdata As String
Dim moveto As String
Dim oFSO As Object
inputdata = Sheets("Variables").Range("B1")
outputdata = Sheets("Variables").Range("B2")
moveto = Sheets("Variables").Range("B3")
Workbooks.Open (inputdata)
'Copy LIBOR 30Y forward curve
Sheets("libor 1m1m 30yrs").Select
Range("A11:C369").Select
Selection.Copy
Windows("Daily Valuation.xlsm").Activate
Worksheets("Yield Curve").Activate
Range("B3").Select
ActiveSheet.Paste
'Copy spot for LIBOR curve
Windows("Try_Acc_DailyVALS.xlsx").Activate
Range("B10").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Daily Valuation.xlsm").Activate
Worksheets("Yield Curve").Activate
Range("D2").Select
ActiveSheet.Paste
'Copy spot rate for SONIA curve
Windows("Try_Acc_DailyVALS.xlsx").Activate
Sheets("sonia 1m1m 30yrs").Select
Range("B10").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Daily Valuation.xlsm").Activate
Worksheets("Yield Curve").Activate
Range("J2").Select
ActiveSheet.Paste
'Copy SONIA 30Y forward curve
Windows("Try_Acc_DailyVALS.xlsx").Activate
Range("A11:C369").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Daily Valuation.xlsm").Activate
Worksheets("Yield Curve").Activate
Range("H3").Select
ActiveSheet.Paste
'Copy EUR-GBP 30Y forward rate
Sheets("fx rates").Select
Windows("Try_Acc_DailyVALS.xlsx").Activate
Sheets("GBP EUR FWD 5Y").Select
Range("B10:F27").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Daily Valuation.xlsm").Activate
Worksheets("fx rates").Activate
Range("C5").Select
ActiveSheet.Paste
Workbooks("Try_Acc_DailyVALS.xlsx").Close
'Save the model for todays date in xlsx format
Workbook.SaveAs Filename:=outputdata
'Move output to control folder
Set oFSO = CreateObject("Scripting.FileSystemObject")
oFSO.MoveFile outputdata, moveto
FSO_MoveFile = True
Application.Quit
End Sub