0

I'm new to using VBA, and I can't seem to get this function to work:

ActiveCell.Formula = "=IF(W2 = 0, "", IF(W2 < 2.5, IF(W2 > -2.5, "Nominal", "REMOVE"), "REMOVE"))"

My goal is to mark any balance that is 0 with no note, any other balance within the range of -2.5 - 2.5 as nominal, and all other balances will have the note of REMOVE. However I keep getting the error "Compile error: Expected: end of statement." If i double up on the quotations around the text areas i don't get the compile error anymore, but then i get a runtime error. Any help is greatly appreciated.

mbrans
  • 1
  • `ActiveCell.Formula = "=IF(W2 = 0, """", IF(W2 < 2.5, IF(W2 > -2.5, ""Nominal"", ""REMOVE""), ""REMOVE""))"` – BigBen Oct 05 '21 at 18:41
  • Shorter formula: `"=IF(W2=0,"""",IF(ABS(W2)<2.5,""Nominal"",""REMOVE""))"`. – BigBen Oct 05 '21 at 18:43

0 Answers0