Insert formula every nth Row?

Retail_Therapy

New Member
Joined
Nov 22, 2017
Messages
10
From Columns AN to BB (15 columns in total), I have a match/index formula that needs to be inserted every 11th row.
Does anyone know of a VBA code to perform this?

Note: each of the 15 column is a unique match/index formula catered to that specific column cell.

Thank you in advance,
Kim
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe something like this:
Code:
Sub MyInsert()

    Dim r As Long
    
    Application.ScreenUpdating = False
    
'   Set initial row to insert first formula on
    r = 11
    
'   Loop until column AN is blank
    Do Until Cells(r, "AN") = ""
'       Insert blank row
        Rows(r).Insert
'       Insert formulas
        Cells(r, "AN").Formula = "=ROW()"
        Cells(r, "BB").Formula = "=COLUMN()"
'       Add 11 to row counter
        r = r + 11
    Loop
    
    Application.ScreenUpdating = True
    
End Sub
Obviously, you will want to replace the formulas I used with whatever formulas you want.
 
Last edited:
Upvote 0
first row of formulas is in row #5
so AN5, AO5, AP5, AQ5, AR5, AS5... ETC
Yep, then just initially set r to 5,
Code:
'   Set initial row to insert first formula on
    r = 5
 
Upvote 0
do I enter the forumla in between the quotation mark below:

Do Until Cells(r, "AN") = ""

thank you for your prompt assistance!
 
Upvote 0
do I enter the forumla in between the quotation mark below:

Do Until Cells(r, "AN") = ""
No. That is just telling it to stop when there is no longer any data in column AN.
We may need to make a slight adjustment to that if it is not picking up your last section of data. Just let me know if that is the case.
 
Upvote 0
yes unfortunately nothing happens when I run it ....
That tells me that you probably do not have any data at all in column AN. Is that the case?

Let's approach this part a little differently.
Can you tell us how we can determine how far down we should go in inserting formulas?
Is it a set number of times? Up to a certain row? Or based on data somewhere on the sheet?
 
Upvote 0
That tells me that you probably do not have any data at all in column AN. Is that the case? there's no data -only a formula in starting from AN5 through BB5. the formula is a match/index derived from 2 worksheets.

Let's approach this part a little differently.
Can you tell us how we can determine how far down we should go in inserting formulas? from AN5:BB5 all the way to row #2942 -formula needs to be inserted every 11th row only. right now I'm just copying/pasting the formulas every 11th row but with this amount data it is very repetitive.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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