Dear all,
I need a VBA that finds a value found multiple times in a row and when it finds the value will copy the row where the value is and insert it below.
So far I have:
Sub copy_insert()
Dim c As Range
For Each c In Range("A1:A30")
If c.Value = "aaa" Then
c.EntireRow.Copy
c.Offset(1, 0).EntireRow.Insert
End If
Next c
End Sub
But this will always fail, if I comment the Insert or the copy line will work, but both together, no.
Please help me with a fix.
Thank you!
I need a VBA that finds a value found multiple times in a row and when it finds the value will copy the row where the value is and insert it below.
So far I have:
Sub copy_insert()
Dim c As Range
For Each c In Range("A1:A30")
If c.Value = "aaa" Then
c.EntireRow.Copy
c.Offset(1, 0).EntireRow.Insert
End If
Next c
End Sub
But this will always fail, if I comment the Insert or the copy line will work, but both together, no.
Please help me with a fix.
Thank you!