View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Creating Loops

Hi David
try the following macro. It tests column A and inserts a blank row if
the values change
Sub insert_rows()
Dim lastrow As Long
Dim row_index As Long

lastrow = ActiveSheet.Cells(Rows.count, "A").End(xlUp).row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "A").Value < Cells(row_index + 1, "A").Value
Then
Cells(row_index + 1, "A").resize(10,1).EntireRow.Insert
(xlShiftDown)
End If
Next
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


David wrote:
I have a list of 40 names, and I need to insert 10 rows in between
each of them and then copy a formula from c2..ac10 and then move down
to the name and do it again.