![]() |
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 |
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 |
All times are GMT +1. The time now is 02:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com