I've made what i thought is a simple script in VBA that performs the specified formula and applies it all the way down column D. When i run it i get a Runtime Error 13 Type mismatch. Ive narrowed it down the actual formula part by replacing the formula with something simple like 1+1 and then it works fine. Any advise?
Type Mismatch error on:
Sub FillFormula()
Range("D2").Formula = "=SUBSTITUTE(D2;" - ";"")"
Range("D2", "D" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
End Sub
Works fine with:
Sub FillFormula()
Range("D2").Formula = "=1+1"
Range("D2", "D" & Cells(Rows.Count, 1).End(xlUp).Row).FillDown
End Sub