1
I was trying to copy the formula from N39 up to the last row but I'm always getting a Run-time error '1004' refer to this line:
n.formula = "=IF(AND(ISNUMBER(K39),ISNUMBER(L39))=TRUE,IF(ISNUMBER(M39),(K39-L39)*M39,(K39-L39)),"")"
However, when I tried changing the formula to something simpler, like =L39-K39, the code works fine.
I would appreciate any help troubleshooting my code.
Here's my code
Sub FillDownFormula()
Dim LastRow As Long
Dim n As Range
LastRow = Cells(Rows.Count, "I").End(xlUp).Row
Set n = Range("N39:N" & LastRow)
n.formula = "=IF(AND(ISNUMBER(K39),ISNUMBER(L39))=TRUE,IF(ISNUMBER(M39),(K39-L39)*M39,(K39-L39)),"")"
Set n = Nothing
End Sub
thanks.