I use this code to put a formula in a range of cells. If I run the code, I get the VBA-error "1004 Application-defined or object-defined error". If I then place the same formula in a cell on a worksheet in Excel, the calculations are done as expected. Why can't I place the formula from VBA?
Code:
shtMenu.Range(Cells(iMenuMinRow, iTblBaseColumn + 5), Cells(iMenuMaxRow, iTblBaseColumn + 5)).FormulaR1C1 = _
"=SUMPRODUCT((Brongegevens!R2C1:R65536C1=RC[-4])*(Brongegevens!R2C5:R65536C5=RC[-2]);Brongegevens!R2C14:R65536C14)"