If a row between row 2 and row 5000 does not contain the word alpha in column M, I would like it deleted. Wondering best way to do this via macros.
If a row between row 2 and row 5000 does not contain the word alpha in column M, I would like it deleted. Wondering best way to do this via macros.
Last edited by undergraduate; 05-07-2010 at 03:21 PM.
Easiest way is with the Data > Filter > Autofilter. Turn that on and filter than column by Custom: Does not contain: alpha. Then delete all rows left visible. Turn off the Autofilter.
You could record that into a macro in seconds.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
thank you that should work!
Please Login or Register to view this content.
Last edited by undergraduate; 05-07-2010 at 03:31 PM.
Actually, I was just wondering is there any way to make alpha a variable instead so in other words.
Criteria1:=<>variable, would that work?
Undergraduate, if you haven't read through the Forum Rules, do so now so you can use and follow them effectively. For instance, you'll need to EDIT that post above and put code tags around that code you used. (Like shown in my signature)
Your code appears to clear data, not delete the rows, this would leave a vast number of blanks all through your data set. Might I suggest:
Please Login or Register to view this content.
Last edited by JBeaucaire; 05-07-2010 at 03:35 PM. Reason: corrected code to delete entire rows
For a variable:
Please Login or Register to view this content.
Last edited by JBeaucaire; 05-07-2010 at 04:00 PM. Reason: Corrected code to delete entire rows
Thank you that is useful, I apologize for not abiding by the rules.
I tried running at again a second time and its just deleting everything, since the criteria is variable shouldnt be something like criteria1=<>MyVar?
Duh...yes, my bad, you're absolutely right. (headbang)
Please Login or Register to view this content.
Also, this is an exact match filter. Are you sure don't want to allow for partial matches?
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks