0

Running into a 1004 - Application-defined or object-defined error while trying to write an mmult formula to a cell:

Sheets("VaR ReCalculation").Activate
Sheets("VaR ReCalculation").Range(Cells(38, 9), Cells(38, 9)).Formula2 = "=MMULT(R[-2]C#;R[-36]C:R[-4]C[32])"

If, however, I enter the same formula to the same cell manually it works perfectly.

I don't want to multiply matrixes in vba, i need it to be visible in the worksheet.

user9423162
  • 27
  • 1
  • 6
  • 2
    Use `.Formula2R1C1` and change the `;` to `,`. Or use `.Formula2R1C1Local`. – BigBen Apr 19 '21 at 18:42
  • 1
    Also, don't `Activate`, rather qualify the `Cells` calls with the worksheet as demonstrated [here](https://stackoverflow.com/questions/8047943/excel-vba-getting-range-from-an-inactive-sheet) and [here](https://stackoverflow.com/questions/17733541/why-does-range-work-but-not-cells). – BigBen Apr 19 '21 at 18:43

0 Answers0