Insert same text every nth row

mr_pepps

New Member
Joined
Nov 13, 2017
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I've searched the forums for a suitable answer to this problem but so far with no success.

  • I have a small worksheet with only 1701 rows of data.
  • I need to insert a new row every 5th row.
  • In that new row I need to populate 3 cells (D, E and F) with the same data each time, all the way down through the worksheet.

Can anyone help me with some vba that might make this job nice and easy?

Huge appreciation in advance,

mr_pepps
(Newbie)


P.S.

I did find this online, but it only iserts new text every other row, not every nth row. Could this be modified?


Sub inserttexteveryonerow()
Dim Last As Integer
Dim emptyRow As Integer
Last = Range("A" & Rows.Count).End(xlUp).Row
For emptyRow = Last To 2 Step -1
If Not Cells(emptyRow, 2).Value = "" Then
Rows(emptyRow).Resize(1).Insert
Range(Cells(emptyRow, "D"), Cells(emptyRow, "F")).Value = Array("0050", "FTPm6binder", "M6 x 10mm M/S flanged stud")
End If
Next emptyRow
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Welcome to the Board!

The "Step" tells it how many rows to move up with. So change it from -1 to -4 (since you are inserting a row).
 
Upvote 0
@Joe4

Ah brilliant that sorts me out a proper treat! Great work thank you!
 
Upvote 0
You are welcome!
Glad I was able to help.
 
Upvote 0

Forum statistics

Threads
1,223,944
Messages
6,175,554
Members
452,652
Latest member
eduedu

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