how can i write a FormulaR1C1 in vba?
i want to set the formula in cell V2 to "=IF(SUM(B2:U2)>0,SUM(B2:U2),"")"
how can i do that in my macro?
question2: how do i filldown column V?
Printable View
how can i write a FormulaR1C1 in vba?
i want to set the formula in cell V2 to "=IF(SUM(B2:U2)>0,SUM(B2:U2),"")"
how can i do that in my macro?
question2: how do i filldown column V?
=IF(SUM(RC[-20]:RC[-1])>0,SUM(RC[-20]:RC[-1]),"")
to convert, put your formula in v2, then
debug.print range("v2").FormulaR1C1
thanks. i worked it out by recording a macro.
how about question 2?
i need to filldown. i've got the column number + the last row used number, but i'm not sure of the syntax for filldown
The quickest way to fill down:
Code:Sheet1.Range("V2:V300").FormulaR1C1 = "=IF(SUM(RC[-20]:RC[-1])>0,SUM(RC[-20]:RC[-1]),"""")"