Forum Discussion
hrh_dash
Jul 26, 2022Iron Contributor
Dynamic subtraction macro showing the formula
I would like to create a dynamic subtraction macro which would display the formula. Currently it is populating an error msg: "run time error 1004 application or object-defined error" Below is...
- Jul 26, 2022
Sub subtract() Dim maxrow As Long maxrow = Tabelle1.Cells(Rows.Count, 2).End(xlUp).Row Range(Cells(12, 4), Cells(maxrow, 4)).FormulaR1C1 = "=RC[-2]-RC[-1]" End SubMaybe with this code. In the attached file you can click the button in cell F5 to run the macro.
Harun24HR
Jul 26, 2022Bronze Contributor
Try Set ws = Sheets("Sheet1")