ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   adding rows to excel table (https://www.excelbanter.com/new-users-excel/84936-adding-rows-excel-table.html)

haystack

adding rows to excel table
 
I have created an inventory table with about 500 rows (one per item). Now, I
need to add five blank rows after each already entered row. These 5 new rows
contain a formula that is constant throughout the whole thing. Is there a
way to do this without manually adding them one by one? can't i just create
one set of the new rows including the formula and tell the program to insert
it after each existing row?

mudraker

adding rows to excel table
 

haystack

here is a macro that will insert 5 blank lines after every row

something similar can be done to insert formulas as required or to copy
a range and paste it into the blank rows


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=535761


mudraker

adding rows to excel table
 

haystack

Looks like I had a hiccup with my previous post as the code did not
show up

here is a macro that will insert 5 blank lines after every row

something similar can be done to insert formulas as required or to copy
a range and paste it into the blank rows


Sub InsertRows()
Dim lRow As Long
For lRow = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Rows(lRow & ":" & lRow + 4).Insert Shift:=xlDown
Next lRow
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=535761


mudraker

adding rows to excel table
 

haystack

Looks like I had a hiccup with my previous post as the code did not
show up

here is a macro that will insert 5 blank lines after every row

something similar can be done to insert formulas as required or to copy
a range and paste it into the blank rows


Sub InsertRows()
Dim lRow As Long
For lRow = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Rows(lRow & ":" & lRow + 4).Insert Shift:=xlDown
Next lRow
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=535761


mudraker

adding rows to excel table
 

haystack

Looks like I had a hiccup with my previous post as the code did not
show up

here is a macro that will insert 5 blank lines after every row

something similar can be done to insert formulas as required or to copy
a range and paste it into the blank rows


Sub InsertRows()
Dim lRow As Long
For lRow = Cells(Rows.Count, "a").End(xlUp).Row To 2 Step -1
Rows(lRow & ":" & lRow + 4).Insert Shift:=xlDown
Next lRow
End Sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=535761



All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com