alu
01-20-2011, 05:24 AM
Hi - I have this code which inserts a blank row everytime there is a change in the value in Column D
Sub InsertRowAtChangeInValue()
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 2 Step -1
If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then Rows(lRow).EntireRow.Insert
Next lRow
End Sub
What I would like is when it inserts a new row for it to copy the contents B, C & D in the cell above
eg if a new row is inserted in row 14 automatically populate B14, C14 & D14 with the values in B13, C13 & D13.
Any suggestions or pointers? thanks in advance...
Sub InsertRowAtChangeInValue()
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 2 Step -1
If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then Rows(lRow).EntireRow.Insert
Next lRow
End Sub
What I would like is when it inserts a new row for it to copy the contents B, C & D in the cell above
eg if a new row is inserted in row 14 automatically populate B14, C14 & D14 with the values in B13, C13 & D13.
Any suggestions or pointers? thanks in advance...