I don't think that you really want a macro. That would wipe out the formula, then if the data changed, you'd want the formula back. Just wrap the formulas in E and F with an IFERROR function.
For example, if E1 contains =SUM(A1:C1)
then change the formula to =IFERROR(SUM(A1:C1),0)