Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
INSERT ROWS
hello
Can somebody write me a code to insert some rows after certain rows. i have data like this 1 5 6 6 8 10 12 .... .... i have to insert 2 number of rows in every 3 data interval. Means i have to insert 2 rows after 6 and 12 and so on upto end. thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
INSERT ROWS
This will give you a little more control over the number of rows that are
inserted: Sub InsertBlankRows() '-- Ken Wright, 2003-08-09 Application.ScreenUpdating = False Dim numRows As Long Dim r As Long Dim Rng As Range Dim lastrw As Long numRows = InputBox("How many Rows") lastrw = Cells(Rows.Count, "A").End(xlUp).Row Set Rng = Range(Cells(1, "A"), Cells(lastrw, "A")) For r = Rng.Rows.Count To 1 Step -3 Rng.Rows(r + 1).Resize(numRows).EntireRow.Insert Next r Application.ScreenUpdating = True End Sub Found the macro he http://www.mvps.org/dmcritchie/excel/insrtrow.htm Regards, Ryan-- -- RyGuy "pmss" wrote: hello Can somebody write me a code to insert some rows after certain rows. i have data like this 1 5 6 6 8 10 12 ... ... i have to insert 2 number of rows in every 3 data interval. Means i have to insert 2 rows after 6 and 12 and so on upto end. thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
INSERT ROWS
Thank you
"ryguy7272" wrote: This will give you a little more control over the number of rows that are inserted: Sub InsertBlankRows() '-- Ken Wright, 2003-08-09 Application.ScreenUpdating = False Dim numRows As Long Dim r As Long Dim Rng As Range Dim lastrw As Long numRows = InputBox("How many Rows") lastrw = Cells(Rows.Count, "A").End(xlUp).Row Set Rng = Range(Cells(1, "A"), Cells(lastrw, "A")) For r = Rng.Rows.Count To 1 Step -3 Rng.Rows(r + 1).Resize(numRows).EntireRow.Insert Next r Application.ScreenUpdating = True End Sub Found the macro he http://www.mvps.org/dmcritchie/excel/insrtrow.htm Regards, Ryan-- -- RyGuy "pmss" wrote: hello Can somebody write me a code to insert some rows after certain rows. i have data like this 1 5 6 6 8 10 12 ... ... i have to insert 2 number of rows in every 3 data interval. Means i have to insert 2 rows after 6 and 12 and so on upto end. thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert rows in a worksheet that do not change adjoining rows | Excel Discussion (Misc queries) | |||
VBA to count rows from specific cell and insert rows | Excel Programming | |||
Insert rows: Formats & formulas extended to additonal rows | Excel Worksheet Functions | |||
Insert page breaks every 50 rows but do not include hidden rows | Excel Programming | |||
Copy Rows and insert these rows before a page break | Excel Programming |