P
PVANS
Good morning
I have the following code to delete all rows that do not contain the
following two variables, in column P, "cw" and "ea".
Set ws = ActiveSheet
For p = ws.Range("P65536").End(xlUp).Row To 1 Step -1
If ws.Cells(p, 16) <> "cw" Then
If ws.Cells(p, 16) <> "ea" Then
ws.Rows(p).Delete
End If
End If
Next
It works very well apart from the fact that it deletes the Header row.
Please can someone assist me in modifying this code so it does not delete Row
1 (the header row).
Thanks for any help in advance, I really appreciate it.
I have the following code to delete all rows that do not contain the
following two variables, in column P, "cw" and "ea".
Set ws = ActiveSheet
For p = ws.Range("P65536").End(xlUp).Row To 1 Step -1
If ws.Cells(p, 16) <> "cw" Then
If ws.Cells(p, 16) <> "ea" Then
ws.Rows(p).Delete
End If
End If
Next
It works very well apart from the fact that it deletes the Header row.
Please can someone assist me in modifying this code so it does not delete Row
1 (the header row).
Thanks for any help in advance, I really appreciate it.