View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default 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