First post so please bear with me. I'm sure this has been asked before but I couldn't find any solution.
I'm trying to get either of these "If" formulas to work in VBA:
ActiveCell.Value = Application.WorksheetFunction.If(ActiveCell.Offset(0, 2)> 0, "RECEIVES", "PAYS")
ActiveCell.Formula = "= If(ActiveCell.Offset(0, 2) > 0, ""RECEIVES"", ""PAYS"")"
The first gives me error code 438, the second a "#NAME?" error as it displays the "Range..." text in the formula.
Using the macro recorder gives me this:
ActiveCell.FormulaR1C1 = "=IF(RC[2]>0,""RECEIVES"",""PAYS"")"
I know the (desired) dfference between the first two, but what am I doing wrong?
Thank you!
Aucun commentaire:
Enregistrer un commentaire