Hi Team,
I am putting subtotal formula above the header. below code works but I want to put both code into single loop.
Thanks
mg
I am putting subtotal formula above the header. below code works but I want to put both code into single loop.
VBA Code:
'Situation on put formula on Second Row - [B]Cells(2[/B], ary1(i)).FormulaR1C1
ary1 = Array(2, 6, 8) ' put formula on second Row
For i = 0 To UBound(ary1)
Cells(2, ary1(i)).FormulaR1C1 = "=SUBTOTAL(9,R4C" & ary1(i) & ":R" & lr_new & "C" & ary1(i) & ")"
Next i
'Put formula on third Row - [B]Cells(3,[/B] ary1(i)).FormulaR1C1
ary1 = Array(3,7) 'Column 3 and 7, put formula on 3rd Row
For i = 0 To UBound(ary1)
Cells(3, ary1(i)).FormulaR1C1 = "=SUBTOTAL(9,R4C" & ary1(i) & ":R" & lr_new & "C" & ary1(i) & ")"
Next i
Thanks
mg
Last edited by a moderator: