Code to insert formula is from macro recorder but it fails when run. I read several post on R1C1 but I am lost.
The formula I am trying to insert is:
Code:
Range("AB36").Select ActiveCell.FormulaR1C1 = _
"=IF(R[18]C[5]<>"""",R[18]C[5],IFERROR(SUM(VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder1"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE),VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder2"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE),VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder3"",DataQuer" & _
"C[-27]:R[-32]C[70],0),FALSE), VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder4"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE), VLOOKUP(R2C16,DataQuery!R[-31]C[-27]:R[464]C[70],MATCH(""CCTVChangeOrder5"",DataQuery!R[-32]C[-27]:R[-32]C[70],0),FALSE)),""""))"
The formula I am trying to insert is:
Code:
=IF(AG54<>"",AG54,IFERROR(SUM(VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder1",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder2",DataQuery!A4:CT4,0),FALSE),VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder3",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder4",DataQuery!A4:CT4,0),FALSE), VLOOKUP($P$2,DataQuery!A5:CT500,MATCH("CCTVChangeOrder5",DataQuery!A4:CT4,0),FALSE)),""))