Trying to run a sumifs through a for next loop

Newfs_R_Sublime

Board Regular
Joined
Jan 20, 2011
Messages
99
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.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,604
Messages
5,838,332
Members
430,538
Latest member
PedroOliveira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top