I am trying to create a macro that will automatically insert 2 rows in the two rows adjacent to each other do not equal. It works perfectly for about the first 1000 rows and then all of a sudden it stops working. I don't know if there is some other issue at work here but wanted to see if anyone had any ideas.


Sub test()

Dim position As Integer
For position = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
With Range("A" & position)
If .Offset(position, 0).Value <> .Offset(position + 1, 0).Value And .Offset(position, 0).Value <> 0 And .Offset(position, 0).Value <> "Position" Then
.Offset(position + 1, 0).EntireRow.Insert
.Offset(position + 1, 0).EntireRow.Insert
End If
End With
Next position
End Sub