samedi 28 mars 2015

if statement inside formular1c1 and error 1004

I'm trying to automatically fill a range with formulaR1C1 and a = IF() i recorded before, but I keep getting a 1004 error. I have this loop running several time in this particular sub, and it works well for every other formula, but with the = IF() it 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))
With subgain
For Each rcell1 In subgain
rcell1.FormulaR1C1 = "=IF(RC[-1]>0;RC[-1];0)"
Next rcell1
End With


Any idea pliz?


Aucun commentaire:

Enregistrer un commentaire