View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Benjamin Benjamin is offline
external usenet poster
 
Posts: 102
Default Macro to delete row if

The first answer from DanPtWash works when the cell is blank. How would I
adjust this to delete the row if the cell has the word "part"?

Rick - I am looking for the macro to examine multiple rows, but I don't have
an index value or name like you describe to show the end of data. What are
the downfalls of running through the entire worksheet?

Thank you both.

"Rick Rothstein (MVP - VB)" wrote:

If you asking your question for a single cell only (set which cell in the
Range function call)...

Sub DeleteRowBasedOnSingleCell()
With Range("D4")
If Len(.Value) = 0 Or Not IsNumeric(.Value) Then .EntireRow.Delete
End With
End Sub

If, instead, you are asking for a macro that will examine multiple cells in
a given Column, is there a column that holds data which can be used to tell
the macro when to stop deleting? Note, it cannot be the column which you are
checking for words or for being blank (otherwise ALL rows below the last
entry, down to the bottom of the grid, will be processed); so, if Column D
is the column being checked, then is (for an example) Column A containing an
index value or Names or something so the bottom of your data can be found?
Or did you just want to process selected rows of data?

Rick


"Benjamin" wrote in message
...
I am looking for a macro to delete an entire row if a cell contains certain
words or is blank.

Thanks.