#### Gilbfernandes

##### New Member

- Joined
- Jan 26, 2016

- Messages
- 20

I'm trying to enter a formula in a given cell indicated by Range("P" & LastRow + 1), but for some reason it's not working.

If I enter the formula manually at the range, it works perfectly. That is the formula :

=IFERROR(IF(O65>0, _

IF('56'!$E$11=3000,DAYS360(TODAY(),O65+12*30), _

IF('56'!$E$11=3500,DAYS360(TODAY(),O65+14*30), _

IF('56'!$E$11=4000,DAYS360(TODAY(),O65+16*30), _

IF('56'!$E$11=4500,DAYS360(TODAY(),O65+18*30), _

IF('56'!$E$11=5000,DAYS360(TODAY(),O65+20*30), _

IF('56'!$E$11=5500,DAYS360(TODAY(),O65+22*30), _

IF('56'!$E$11=6000,DAYS360(TODAY(),O65+24*30),"")))))))),"")

The way I am entering it with VBA is:

Range("P" & LastRow + 1) = "=IFERROR(IF(O" & LastRow + 1 & ">0," _

& "IF('" & LinkNumber & "'!$E$11=3000,DAYS360(TODAY(),O" & LastRow + 1 & "+12*30)," _

& "IF('" & LinkNumber & "'!$E$11=3500,DAYS360(TODAY(),O" & LastRow + 1 & "+14*30)," _

& "IF('" & LinkNumber & "'!$E$11=4000,DAYS360(TODAY(),O" & LastRow + 1 & "+16*30)," _

& "IF('" & LinkNumber & "'!$E$11=4500,DAYS360(TODAY(),O" & LastRow + 1 & "+18*30)," _

& "IF('" & LinkNumber & "'!$E$11=5000,DAYS360(TODAY(),O" & LastRow + 1 & "+20*30)," _

& "IF('" & LinkNumber & "'!$E$11=5500,DAYS360(TODAY(),O" & LastRow + 1 & "+22*30)," _

& "IF('" & LinkNumber & "'!$E$11=6000,DAYS360(TODAY(),O" & LastRow + 1 & "+24*30),"")))))))),"")"

But it is not working. Could someone tell me why it is not working ???

Thank you.