Inserting Multiple Rows after every row

September 27, 2010 at 07:02:19
Specs: Windows Vista

I've a excel sheet contains 3000 record, want a macro to insert n number of rows after each record.

pls help.

See More: Inserting Multiple Rows after every row

September 27, 2010 at 10:20:43
This code assumes you have data in Column A since it will look for the bottom of Column A to determine how long the data set is.

It will ask the User to enter the number of rows to insert between each piece of data.

Option Explicit
Sub InsertRows()
Dim rw, LastRow, inRows, numRows As Double
'Get Number of Rows to insert from User
 numRows = Application.InputBox("Enter The Number Of Rows To Insert")
'Find last row with data in Column A
 LastRow = Cells(65536, 1).End(xlUp).Row
'Loop through data, inserting rows
  For rw = LastRow To 2 Step -1
   For inRows = 1 To numRows
    Rows(rw).Insert Shift:=xlDown
  Next rw
End Sub

Report •

September 27, 2010 at 21:04:02
thnx a lot derby....

it was really helpful.

Report •

September 28, 2010 at 06:51:13
want a macro to paste the values in the new inserted rows from the above one.


            B                            C                              D

C1 shifts down in B2 and D1 shifts down in B3 and so on for n columns...

pls help.

Report •

Related Solutions

September 28, 2010 at 11:00:30
So why didn't you tell us about this requirement when you asked your first question?

I doubt this requirement just suddenly came to light.

What else about this project haven't you told us?

Report •

September 28, 2010 at 20:38:02
Actually u ri8 bt i m new to this site n really i was nt sure that the reply will came.
evn m posting a question very first time...

i'll take care of such things in future...

Report •

September 28, 2010 at 21:18:24
Is n a constant number for a given list in Column A or will it change row by row?

In other words, does each row have data in the same number of columns?

Report •

Ask Question