Thread: Insert Rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Insert Rows

The first column is easy:

Sub InsrtRw()
Dim lr As Long
Dim Rng1 As Range
lr = Cells(Rows.Count, 3).End(xlUp).Row
Set Rng1 = Range("C1:C" & lr)
For i = lr To 2 Step -1
If Range("C" & i) < Range("C" & i - 1) Then
Range("C" & i & ":C" & i + 1).EntireRow.Insert
End If
Next
End Sub

However, once you insert blank rows for column C, it leaves a lot of blank
spaces in column D also. It could be done for column D, but not using the
same logic as for column C.

" wrote:

Hi,
I have a Excel file in Column "C" I have numbers like
101,103,108,110,111, and so on..... also in Column "D" I have numbers
like 15002,19404 ...... I need a macro that first looks in Column "C"
and whenever the numbers change to insert 2 rows right where the
change take place. And then Look in Column "D" and do the same.

I appreciate any help Thanks!