View Single Post
  #1   Report Post  
Esrei
 
Posts: n/a
Default Macro to copy cells

I have this macro that inserts 26 rows when the value in B changes. (Works
wonderfull)
Now I want the macro to after 26 rows were inserted copy Range B2:K25 to the
2nd row in the range that were inserted.
in other words find a value in B move 2 cells down and past B:K
Hope I make sence. I am inserting a header for invoice lines.



Sub Deilv()
Dim LastRow As Long
Dim row_index As Long
Application.ScreenUpdating = False
LastRow = ActiveSheet.Cells(Rows.Count, "b").End(xlUp).Row
For row_index = LastRow - 1 To 26 Step -1
If Cells(row_index, "B").Value < _
Cells(row_index + 1, "B").Value Then
Cells(row_index + 1, "B").Resize(26).EntireRow. _
insert Shift:=xlDown
End If
Next
Application.ScreenUpdating = True
End Sub