Deleting rows with specific value from row 1 to 200

  • Thread starter Thread starter solo_razor
  • Start date Start date
S

solo_razor

Hello,

I want to delete rows with specific values in column c and d. This
criteria must be done from row 1 to row 200.

Regards,
Niek
 
DIM keyvalue as double
DIM rw as long
keyvalue = 123.45
FOR rw = 200 TO 1 step -1
IF cells(rw,"C") = keyvalue _
OR _
cells(rw,"d") = keyvalue Then
Rows(rw).Delete
END IF
NEXT

Note that you need to move 'up' the sheet, hence the
reverse for/next loop. If you did a normal for next,
deleteing row 'n' would move row n+1 to row n, then
the 'next' statment would ponit to the new row n+1, so
the original n+1 row woul dbe 'skipped' over. Difficult
to explain. but try it and see.

Patrick Molloy
Microsoft Excel MVP
 
Back
Top