I want to add a formula to a cell via VBA, but for some reason fail to get it done.
I've tried
ws.Range("O2").Formula = "=DATEDIF($N$2;C1+1;""m"")/3+1"
Error message is 1004 ("Application-defined or object-defined error")
ws.Range("O2").Formula = "=DATEDIF($N$2;C1+1;" & Char(34) & "m" & Char(34) & ")/3+1"
Error message here is "Sub or function not defined"
How do I do this?