unknownymous
Board Regular
- Joined
- Sep 19, 2017
- Messages
- 249
- Office Version
- 2016
- Platform
- Windows
Hello Guys,
I have long list of data and I want to insert a blank row after every nth row for example after. Below is the sample initial illustration. I need to add starting
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]ID[/TD]
[TD]Name[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]001[/TD]
[TD]BEN[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
The data starts in A4 onwards and what I need is to add blank in every 5th row. Can you possibly help me modify below codes?
Sub InsertRowEveryXrows()
Dim r As Long, lr As Long
lr = Range("B" & Rows.Count).End(xlUp).Row
For r = 4 To lr Step 10
Rows(r).Insert Shift:=xlDown
Next r
End Sub
Any help will be much appreciated (beginner here). Thanks!
I have long list of data and I want to insert a blank row after every nth row for example after. Below is the sample initial illustration. I need to add starting
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]ID[/TD]
[TD]Name[/TD]
[TD]Score[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]001[/TD]
[TD]BEN[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
The data starts in A4 onwards and what I need is to add blank in every 5th row. Can you possibly help me modify below codes?
Sub InsertRowEveryXrows()
Dim r As Long, lr As Long
lr = Range("B" & Rows.Count).End(xlUp).Row
For r = 4 To lr Step 10
Rows(r).Insert Shift:=xlDown
Next r
End Sub
Any help will be much appreciated (beginner here). Thanks!
Last edited: