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 (- 35 , 1 ). 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 (- 34 , 1 ). 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 (- 33 , 1 ). 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 (- 32 , 26 ). 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 (- 32 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,4,0),0)"
ActiveCell . Offset (- 31 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,5,0),0)"
ActiveCell . Offset (- 30 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,6,0),0)"
ActiveCell . Offset (- 29 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,8,0),0)"
ActiveCell . Offset (- 27 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,9,0),0)"
ActiveCell . Offset (- 26 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,10,0),0)"
ActiveCell . Offset (- 25 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . FormulaR1C1 = _
"=IFERROR(VLOOKUP(R2C2,'Operation Workbook Summary.xlsx'!R2C2:R1000C12,11,0),0)"
ActiveCell . Offset (- 23 , 1 ). Range ( "A1:C1" ). Select
ActiveCell . Offset ( 21 , 2 ). Range ( "A1" ). Select
Selection . ClearContents
ActiveCell . Offset (- 1 , - 2 ). Range ( "A1" ). Select
Selection . ClearContents
ActiveWorkbook . Save
End Sub
Your help will be most appreciated.
Bookmarks