Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default loop to insert rows

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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop relative rows PST Excel Discussion (Misc queries) 1 May 20th 07 12:23 PM
Insert Variable Number of Rows; With Loop ryguy7272 Excel Worksheet Functions 2 December 27th 06 08:25 PM
Cannot loop through rows in C# Howard Excel Programming 2 February 5th 04 03:39 PM
Cant run insert row through loop WashoeJeff Excel Programming 1 January 23rd 04 12:48 PM
help on insert rows and fill down loop until end mark mcgrath Excel Programming 1 January 16th 04 01:50 AM


All times are GMT +1. The time now is 07:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"