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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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
Back
Top