Good day all,

I am looking for a macro to allow me to insert multiple vlookups onto a spreadsheet which is utilised as a template. My template basically creates another sheet and transfers the data as well, thereafter clears the selected range from the template thereby also removing the formulas as well. I would like a macro that would reinsert these formulas. I tried to record a macro by physically inserting the formulas one by one but I get a run time error. The recorded macro is below


PHP Code: 
Option Explicit
Sub Insert_Formulas
()
'
Insert_Formulas Macro
'

'
    
ActiveCell.Offset(-12, -24).Range("A1").Select
    Selection
.ClearContents
    ActiveCell
.Offset(1, -1).Range("A1:C1").Select
    Selection
.ClearContents
    ActiveCell
.Offset(-351).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'C:\Users\Ridwan\Dropbox\Petrocam Finance (Group)\Repository\[PFI_Archive.xlsm]Summary'!R2C2:R1000C17,3),"""")"
    
ActiveCell.Offset(-341).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'C:\Users\Ridwan\Dropbox\Petrocam Finance (Group)\Repository\[PFI_Archive.xlsm]Summary'!R2C2:R1000C17,4),"""")"
    
ActiveCell.Offset(-331).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'C:\Users\Ridwan\Dropbox\Operations (Group)\petrocam operations (Group)\Work in Progress\[Operation Workbook Summary.xlsx]Operation Workbook Summary'!R2C2:R1000C12,7,0),0)"
    
ActiveCell.Offset(-3226).Range("A1").Select
    ActiveCell
.FormulaR1C1 _
        
"IFERROR(VLOOKUP($B$2,'C:\Users\Ridwan\Dropbox\Operations (Group)\petrocam operations (Group)\Work in Progress\Repository\[Operation Workbook Summary.xlsx]Operation Workbook Summary'!$B$2:$L$1000,4,0),0)"
    
ActiveCell.Offset(-321).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,4,0),0)"
    
ActiveCell.Offset(-311).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,5,0),0)"
    
ActiveCell.Offset(-301).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,6,0),0)"
    
ActiveCell.Offset(-291).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,8,0),0)"
    
ActiveCell.Offset(-271).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,9,0),0)"
    
ActiveCell.Offset(-261).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,10,0),0)"
    
ActiveCell.Offset(-251).Range("A1:C1").Select
    ActiveCell
.FormulaR1C1 _
        
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,11,0),0)"
    
ActiveCell.Offset(-231).Range("A1:C1").Select
    ActiveCell
.Offset(212).Range("A1").Select
    Selection
.ClearContents
    ActiveCell
.Offset(-1, -2).Range("A1").Select
    Selection
.ClearContents
        ActiveWorkbook
.Save
End Sub 
Your help will be most appreciated.