Hi, I wanted to insert blank rows below and copy and paste the rows above to those blank rows when certain conditions are met. For example when you see a value 112 in column E then insert a blank row below it and copy and paste that same row above containing the value 112 onto the blank row you just created and also when you see 159 in column E perform this function above. I started building this out but ran into issues. Can someone please take a look? I will much appreciate this. Thanks
Code
Sub pins()
Dim z1, z3, z4 As Range
Set z1 = Sheets("Sheet1").Range("E2:E15").End(xlDown)
Do Until z1.Row = 1
If z1.Value = "112" Then
z1.EntireRow.Offset(1).Insert
End If
Set z1 = z1.Offset(-1)
Loop
Dim z2 As Range
Set z2 = Sheets("Sheet1").Range("E2:E15").End(xlDown)
Do Until z2.Row = 1
If z2.Value = "112" Then
z2.EntireRow.Select
Selection.SpecialCells(xlCellTypeVisible).Copy
z2.Offset(1).Paste
End If
Set z2 = z2.Offset(-1)
Loop
End Sub
Bookmarks