Add a new row after every 10th row in column A with specific Text

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
204
Office Version
  1. 2019
Platform
  1. Windows
I have data in sheet1 in Column A I have values from 1 to 10000. I want that after every 10th row a new row/cell will be inserted and in column A against the new cell text "NEXT" will be added.

What should be the code for this ?? kindly help
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
VBA Code:
Option Explicit

Sub Evry10()
    Dim i As Long
    Dim lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 10 To lr
        Range("A" & i).EntireRow.Insert
        Range("A" & i) = "Next"
        i = i + 10
    Next i
End Sub
 
Upvote 0
VBA Code:
Option Explicit

Sub Evry10()
    Dim i As Long
    Dim lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    For i = 10 To lr
        Range("A" & i).EntireRow.Insert
        Range("A" & i) = "Next"
        i = i + 10
    Next i
End Sub
THANK YOU :) :)
 
Upvote 0
Or this:
VBA Code:
Sub Insert_Rows()
'Modified 6/22/2021  3:41:52 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row

For i = 10 To Lastrow Step 10
    Rows(i).Insert
    Cells(i, 1).Value = "Next"
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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