Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete rows in Excel bsed on cell values

Status
Not open for further replies.

addy

Technical User
May 18, 2001
743
GB
Hi

I have a spreadsheet which has a lot of information in it but most of it is not required and so I am trying to clean the data up.

Each row has a subject in column A and then info in column B. What I would like to do is to have some code which will work through each row in column A, and if the cell contents equal either Criteria1 or Criteria2 then move to the next row, else, delete the entire row.

Any help at all would be appreciated.

thanks.
 
record yourself using the autofilter to filter the records for those you want to delete
Delete all rows (hidden rows will not be deleted)
un-filter

et voila

If you record yourself performing these actions using the macrorecorder, you should get some workable code...

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
autofilter.

Why the hell did I not think of that?

You are a genius sir.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top