View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
TP[_4_] TP[_4_] is offline
external usenet poster
 
Posts: 3
Default Inserting Entire Rows

Hi,

Would somebody be able to help me?
I have a excel spreadsheet and wanted a macro that would insert an
entire row everytime the number above it in column C was different.
eg.

A B C
1 10 1 20
2 11 3 20
3 12 21 30 < Insert Row
4 13 27 30
5 14 11 40 < Insert Row


So far this is the only code i can write but it wont work:

Dim i As Integer
i = 2
While Range("C" & i) < ""
Do
If Range("C" & i) < Range("C" & i + 1) Then
Rows(i & ":" & i + 1).Insert Shift:=xlDown
i = i + 1
End If
i = i + 1
Loop
Wend

End Sub



Would anybody be able to assist me?

TP