if语句在formular1c1和1004错误
我试图自动填充公式R1C1和a = IF()
我之前录制的范围,但我不断收到1004错误。 我有这个循环运行几次在这个特定的子,它适用于所有其他公式,但= IF()
它不工作…
rcell1.FormulaR1C1 = "=IF(RC[-1]>0;RC[-1];0)"
。
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
任何想法PLIZ?
你的公式中有一个语法错误,你正在使用;
作为分隔符,但它应该是,而不是,
。 replace这个:
rcell1.FormulaR1C1 = "=IF(RC[-1]>0;RC[-1];0)
有了这个:
rcell1.FormulaR1C1 = "=IF(RC[-1]>0,RC[-1],0)"
它应该工作正常。