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

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
199
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

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
6,547
Office Version
  1. 365
Platform
  1. Windows
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
 

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
199
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 :) :)
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
17,910
Office Version
  1. 2013
Platform
  1. Windows
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
 

Forum statistics

Threads
1,143,619
Messages
5,719,764
Members
422,244
Latest member
AYSHANA

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
Top