I am trying to add an IF formula to a cell in excel using a macro and it is displaying a 1004 application-defined or object-defined error for the .Range line. How can I prevent this error?
Sub AddFormula()
Dim Formula As Variant
With ThisWorkbook.Worksheets("Form Responses 1")
.Range("CE2").Formula = "=IFERROR(IF(OR((BZ2=""No"", BZ2=""0"")), BZ2, AN2), AN2)"
End With
End Sub
Thanks