VBA Help: delete whole row if the cell does not contain string "*"

  • Thread starter Thread starter zenzen
  • Start date Start date
Z

zenzen

Hi all,

I am only a beginner in VBA. I have come across the problem where I
have a range of data in excel. In each rows, I want to check if the
cell in that row does contain a string "*".

If the row where the cell does not contain string "*" I want to delete
the whole row.


I am having problem in figure out how to relate each cell search if it
contains a string"*".

Can anyone give me some idea/help?

Thanks

ZenZen
 
Pseudo-code:

Loop down the column of the cells you are checking, something like...

Do
{Check Deletion criteria}
move one row down
Loop until end criteria

If the deletion criteria matches, move to the next row and then delete the
previous.

Checkcell.offset(-1,0).entirerow.delete

HTH
 
when you need to delete a row, it's better to start at the last row and work
your way up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top