• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

add two blank rows after every record

kaushik03

Member
Hi all,


I have a data set of 500 rows.


trying to add two blank rows after every record through VBA.


Can u plz get me the code?


Kaushik
 
Hi Kaushik


Glad you solve the problem your self


please post the code here i think the same problem is required to someone / Helpful when they search from the search box they will get the result


what do you say


Thanks


SP
 
Hi SP,


This is how I will do it if it is for one time only and no checking for non-blank or already inserted rows etc. I am sure Kaushik also did something similar.

[pre]
Code:
Option Explicit
Public Sub InsertRows()
Dim i As Long
Dim j As Integer
j = Application.InputBox("Please specify number of rows to be inserted e.g. 1,2,3 etc", _
"InsertRow", 1, , , , , 1)
Application.ScreenUpdating = False
For i = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
Range("A" & i).Resize(j, 1).EntireRow.Insert xlDown
Next i
Application.ScreenUpdating = True
End Sub
[/pre]
 
Back
Top