insert a row when theres change in a row.
Yeah, Say you want Column D
Sub InsertRow_D_Chg()
Dim Lrow As Long, vcurrent As String, i As Long
'// find last used cell in Column D
Lrow = Cells(Rows.Count, "D").End(xlUp).Row
'// get the value of that cell in Column D (column 1)
vcurrent = Cells(Lrow, 4).Value
'// rows are inserted by looping from bottom up
For i = Lrow To 2 Step -1
If Cells(i, 4).Value < vcurrent Then
vcurrent = Cells(i, 4).Value
Rows(i + 1).Resize(1).Insert 'NUMBER of Rows to Insert Line
'--Rows(i + 1).Insert to only Insert One Blank Row
End If
Next i
End Sub
"elaine" wrote:
Hi JM,
does it mean that I could choose any column buy change 'A' to what
ever column its on and the code will still work?
Thanks
E.
|