Add new rows after specific rows

D

Dipladenia

Hello!

I would like to add a new row after each row that contains the value "SHOW
MOVIE_PLAYER" in column F (that is, column F contains a number of different
values, and I just want a new row after the ones with that specific value).

I COULD just insert a new row manually, but there´s about 500 of them...

Can anyone help me with this?

Thanks
/Dipladenia
 
B

Bob Phillips

Public Sub ProcessData()
Const TEST_COLUMN As String = "F" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
If .Cells(i, TEST_COLUMN).Value = "SHOW MOVIE_PLAYER" Then
.Rows(i + 1).Insert
End If
Next i
End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Top