excel - if statement inside formular1c1 and error 1004 -


i'm trying automatically fill range formular1c1 , = if() recorded before, keep getting 1004 error. have loop running several time in particular sub, , works every other formula, = if() doesn't work...

the line rcell1.formular1c1 = "=if(rc[-1]>0;rc[-1];0)"is highlighted.

set subgain = range(cells(i - period - 1, 16), cells(i + j, 16)) subgain each rcell1 in subgain        rcell1.formular1c1 = "=if(rc[-1]>0;rc[-1];0)" next rcell1 end 

any idea pliz?

there's syntax error in formula, you're using ; delimiter should instead ,. replace this:

rcell1.formular1c1 = "=if(rc[-1]>0;rc[-1];0) 

with this:

rcell1.formular1c1 = "=if(rc[-1]>0,rc[-1],0)" 

and should work fine.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -