Hi
I've got a Sub which runs successfully until the point where a formula needs to be dragged down to the rest of the column.
In short, data is copied from column H (cell 15 downwards) in the "Main Sheet" of a file called "Main Sheet" and pasted into cell DC15 of the same sheet.
The code then goes to another file called "Formula Wbk" and then transfers that formula to cell DD16 of the "Main Sheet" in the "Main Sheet" file.
However, the code then stops out at the last line of this code, which is supposed to fill the formula from cell DD16 to the rest of column DD (please note the two D's). And I get a debugging error.
Does anyone know why this is? Have I mistyped something?
TIA
I've got a Sub which runs successfully until the point where a formula needs to be dragged down to the rest of the column.
In short, data is copied from column H (cell 15 downwards) in the "Main Sheet" of a file called "Main Sheet" and pasted into cell DC15 of the same sheet.
The code then goes to another file called "Formula Wbk" and then transfers that formula to cell DD16 of the "Main Sheet" in the "Main Sheet" file.
However, the code then stops out at the last line of this code, which is supposed to fill the formula from cell DD16 to the rest of column DD (please note the two D's). And I get a debugging error.
Does anyone know why this is? Have I mistyped something?
TIA
Code:
Sub
Workbooks(Mainsheet).Activate
Worksheets("Main sheet").Select
Range("H15", Range("H15").End(xlDown)).Copy
Range("DC15").PasteSpecial xlPasteValues
Workbooks(Mainsheet).Sheets("Main sheet").Range("DD16").Formula = Workbooks(Formula_Wbk).Sheets("New Data").Range("P2").Formula
Range("DD16:D" & Range("DC" & Rows.Count).End(xlUp).Row).Formula = "=IFERROR((AY16/K16)-AF16,"")"
End Sub