Can anyone help me here? I'm in need of a VB Code.
I need the code to do the following:
If any cell in column "L" = "n/a" then delete that corresponding row.
IE - Cell L23 = n/a so then delete row 23.
Thanks in advance!
Can anyone help me here? I'm in need of a VB Code.
I need the code to do the following:
If any cell in column "L" = "n/a" then delete that corresponding row.
IE - Cell L23 = n/a so then delete row 23.
Thanks in advance!
Last edited by adgjqetuo; 05-12-2009 at 02:02 PM.
Give this a try:
Please Login or Register to view this content.
_________________
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!)
Hmm...you could also do it with an AutoFilter. This does the deleting of rows in one step...definitely faster.
Please Login or Register to view this content.
Last edited by JBeaucaire; 05-12-2009 at 12:37 PM.
Thanks for the help!
I tried both, and I'm getting a "complile error" for option explicit
I got the same error for both codes you provided. any ideas?Please Login or Register to view this content.
Last edited by adgjqetuo; 05-12-2009 at 01:42 PM.
Hah...That goes ABOVE the macros. Sorry about that.
When inserting code provided by others into other macros or commandbuttons, only insert the code between the SUB/END SUB linesPlease Login or Register to view this content.
Still got the error - but when i deleted "option explicid" it worked perfectly!!
Thank you SOOO MUCH!!!
Hey guys, is there a way to do the opposite of this.
Example. - if "l2" doesnt exist , delete row ?
That doesn't make sense, sorry. How are you asking to evaluate the cell? if I2 is blank? Or empty? Then delete row2?
sorry mate - my mistake.
I was hoping to do a DELETE ROW if multiple values do NOT exist.
The value can be into the thousands - because i only need the results which include 25 values.
It might be possible to get a script to run through the sheet and delete and row , if it does not contain one of my 25 value's.
So it would be a ARRAY ??
Yes, you can loop through a dataset and compare a cell's value to a list and delete the row if it does not match any of your values.
Please Login or Register to view this content.
oh mate, thats excellent.
is there any chance you could explain how this line works
Case "Dog", "Cat", 10 to 20, 99, "Bird"
I was hoping to use something like this first - so i can easily modify it later to suit.
vlist = array("test01", "Test07", "Test21", "Test94")
case = vlist
????
Got it sorted. Thankyou very much mate. sorry to hijack the thread
Hi guys,
How could I smilarly do the following;
where their are 4 text values which could match multiple numbers .eg a row is completely deleted if one of the numbers matches one of the 4 text values on the same row.
thanking in advance
The code in post 10 showed how to LEAVE the rows alone if they matched specific things, and delete the rest. You can use the same code but put the "delete" code into the section that is matching the text strings.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks