Deleting rows conditionally

Copper Contributor

I am trying to automate a particular function in Ms Excel 2013 (and later). The details are as follows:

 

If a particular field has a particular string, I would like the entire row to be deleted.

The field has custom string (text) so its able to accept everything, however, if a certain string appears, lets assume the string is "he did it". if that appears as part of the string in that one field, action should delete the entire row. 

 

The question is, what is the best approach to implement that. Is it using VBA (or Macros) or could this be done without VBA. 

 

In addition, could the same be done using an app done in C#, if so, how??

5 Replies

pls see attached sample..

before testing - make a backup copy of your work...
Hey, the code works well with the file you have attached. However, it doesn't really work with what I have in place. My field of concern is the between E-I, this is where the string will be checked, and the needful should be done
do you mean to check rows between Columns E to I?
to check these 5 columns if any one of them contains the word - delete the entire row?

pls see attach file.

hope you can make something out of it.

thanks..