I’m using a vba macro to add a formula to a cell which appears to paste into the cell correctly, however it returns an ERR508. If I go into the cell and overtype any character and press enter, the formula works correctly. For example, this is the formula entered by the macro.

=IF(($E$5088>$D$5088),($E$5088-$D$5088),0)

If i remove the trailing “)” and press enter the formula works. Actually if I replace any character and press enter it works.

Here is the code I’m using:

```
dCell = right(dSheet.getCellByposition(3,dRow).absolutename,7)
eCell = right(dSheet.getCellByposition(4,dRow).absolutename,7)
formulaTxt = "=if((" & eCell & ">" & dCell & "),(" & eCell & "-" & dCell & "),0)"
dSheet.getCellByposition(5,dRow).formula = formulaTxt
```

Any help would be greatly appreciated.

Thanks,

Flick