Trying to run a sumifs through a for next loop

Newfs_R_Sublime

Board Regular
Joined
Jan 20, 2011
Messages
97
Range("Q2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=SUMIFS(Variation!C[-5],Variation!C1,RC11,Variation!C3,RC13,Variation!C4,RC14)"
Range("Q3").Select
ActiveCell.FormulaR1C1 = _
"=SUMIFS(Margin!C[-5],Margin!C1,R[-1]C11,Margin!C3,R[-1]C13,Margin!C4,R[-1]C14)"
Range("Q4").Select
ActiveCell.FormulaR1C1 = "=-1*R[-1]C"
Range("Q2:Q4").Select
Selection.AutoFill Destination:=Range("Q2:AT4"), Type:=xlFillDefault
Range("Q2:AT4").Select

The part of the sumifs that I want to cycle through using the FOR NEXT loop is the row. This starts on row 2 and ends at a row number stored at theLen as long

So this would sit within a

For i= 2 to theLen



Next i




Thank you very much in advance for your help.
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Watch MrExcel Video

Forum statistics

Threads
1,109,550
Messages
5,529,472
Members
409,884
Latest member
Msinmath
Top