Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can i create a macro that insert 2 rows
how can i create a macro that selects, lets say column h, inserts two rows
every two rows. column h row 6 254 row 7 -254 row 8 450 row 9 -450 final result should be: column h row 6 254 row 7 -254 inserted row inserted row row 8 450 row 9 -450 inserted row inserted row and so on, thanks a lot for your help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can i create a macro that insert 2 rows
Sub Test()
Dim iLastRow As Long Dim i As Long iLastRow = Cells(Rows.Count, "A").End(xlUp).Row iLastRow = iLastRow - (iLastRow Mod 2 = 0) For i = iLastRow To 2 Step -2 Rows(i).Resize(2).Insert Next i End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "andresg1975" wrote in message ... how can i create a macro that selects, lets say column h, inserts two rows every two rows. column h row 6 254 row 7 -254 row 8 450 row 9 -450 final result should be: column h row 6 254 row 7 -254 inserted row inserted row row 8 450 row 9 -450 inserted row inserted row and so on, thanks a lot for your help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create a control button to insert rows | Excel Discussion (Misc queries) | |||
trying to create an insert row macro | Excel Discussion (Misc queries) | |||
How do I create a Macro to sort data and insert blank rows & subto | Excel Worksheet Functions | |||
how do I create a macro to auto insert rows? | Excel Worksheet Functions | |||
[beginner] create macro to insert symbol | Excel Programming |