View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default Deleting rows with specific value from row 1 to 200

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


-----Original Message-----

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


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.