View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
James W. James W. is offline
external usenet poster
 
Posts: 3
Default loop to insert rows

This might be what your looking for

Sub InsertRows()
Dim cRows As Long
Dim i As Integer

For i = Cells(Rows.Count, "A").End(xlUp).row To 2 Step -1
If Cells(i, "A") < "" And Cells(i - 1, "A") < "" Then
Cells(i, "A").EntireRow.Insert
End If
Next i
End Sub

"Fergie" wrote:

I need code for a loop that will insert a row (above) then go to the next row
and insert a row. I have code to insert rows however, I get into an infinite
loop.

Thanks!