Insert New row if Column G = "P"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I can't seem to get this, but
if I wanted to run a macro that
would start at cell G50 and
move upward to Cell G18 testing for the
value P and if it is found insert a single
row beneath it (passing on all other
rows that do not have P), how would I
do this?
TIA,
 
Try:

Sub InsertRow()
For irow = 50 To 8 Step -1
If Cells(irow, "G") = "P" Then
Cells(irow + 1, "G").Insert Shift:=xlDown
End If
Next irow
End Sub
 
Back
Top