VBA Loop formula

VbaHell

Well-known Member
Joined
Jan 30, 2011
Messages
1,220
Hello all

Can I have help please on this loop please.

I want to complete a sumifs statement in cell "D9" and then replicate this every 4 cell down in column "D" until I get to cell "D2597"

Tried to put this together but failed


Code:
Dim i As Integer
Range("D9").Select
i = 1
Do Until i > 2597
    Cells(i, 1).Value = .FormulaR1C1 = "=SUMIFS('Data'!C18,'Data'!C[5],R[-1]C[-2],'Data'!C22,Sheet1!R3C4,'Data'!C23,Sheet1!R5C3)"
    i = i + 4
Loop
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
How about
Code:
Dim i As Long
For i = 9 To 2597 Step 4
   Cells(i, 4).FormulaR1C1 = "=SUMIFS('Data'!C18,'Data'!C[5],R[-1]C[-2],'Data'!C22,Sheet1!R3C4,'Data'!C23,Sheet1!R5C3)"
Next i
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Fluff at the moment this puts the formula in column 4
Is it possible to populate columns 4 to 16 with the same formula please or should I just use this loop 12 times
 
Upvote 0
Try
Code:
   Cells(i, 4).Resize(, 12).FormulaR1C1 = "=SUMIFS('Data'!C18,'Data'!C[5],R[-1]C[-2],'Data'!C22,Sheet1!R3C4,'Data'!C23,Sheet1!R5C3)"
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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