loop formula

VbaHell

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

Can you help on this please

This loop formula start at row 13 and then step through every 5 rows


Code:
For p = 13 To 3251 Step 5
    Cells(s, 4).Resize(, 12).FormulaR1C1 = "=IF(R[-2]C="""","""",R[-2]C-R[-1]C)"
Next p

This time I am looking for a loop that starts at row 13 but only in column "P"
inserts a formula in row 13,14,15,16 then misses one row, then populates 18,19,20,21 misses one row Etc until row 3251

This is the formula I want to insert

Code:
.FormulaR1C1 = "=SUM(RC[-12]:RC[-1])"
 
Last edited:

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try:
Code:
Sub test()
    Dim p As Long
    For p = 13 To 3251 Step 5
        Cells(p, 16).Resize(4, 1).FormulaR1C1 = "=SUM(RC[-12]:RC[-1])"
    Next p
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

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