+ Reply to Thread
Results 1 to 7 of 7

Deleting rows if value is or is not in several columns?

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Amsterdam, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Deleting rows if value is or is not in several columns?

    Sorry about the unclear title, but it's complicated. For me at least. Here's the thing:


    I've been horsing around with macro's and VBA in Excel 2010 since a few days and I've accomplished quite something so far (I like to pat myself on the shoulder, thank you), but there's one thing I have not yet achieved and my deadline is today. Here's the problem:

    I have an Excel file with a (*)load of rows in it, 5.000 or more, and columns from A to Q. These are the results of a webform. Columns are the fields of the form, rows are the filled out answers. Unfortunately, a lot of the rows are bogus, haven't been filled out and are basically just blank cells or "Please make a choice". Now, what I want is to filter all those bogus rows out, but keep every row that has even the tiniest bit of filled out information in it. The columns I, J & P are the ones in particular where this is applicable.

    So I guess I need something like "delete row if none of it's cells in column I, J or P is anything other than "" or "Please make a choice"". Does that sound logical? And if so, how would I do this in a very simple, few line bit of VBA code?


    Thanks in advance!


    CWIkikker

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Deleting rows if value is or is not in several columns?

    Try

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    01-21-2013
    Location
    Amsterdam, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Deleting rows if value is or is not in several columns?

    I'll try, thanks!

  4. #4
    Registered User
    Join Date
    01-21-2013
    Location
    Amsterdam, the Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Deleting rows if value is or is not in several columns?

    Yes, it worked like mad yo! You made me a very happy puppy. I have no idea how it did what it did, I'll look in to that, but it did what I wanted it to do and narrowed the whole sheet down to 300something rows, just as expected and by first glance everything is just as I wanted it. Very much a lot of thank you's!

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Deleting rows if value is or is not in several columns?

    or:
    Please Login or Register  to view this content.



  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Deleting rows if value is or is not in several columns?

    @snb,

    Out of interest, let me see if I understand your code. First you replace the text "Please make a choice" with "", right? The next statement would delete each row if the cell in column 9 is empty, right? But it should not delete that specific row if a value was found in column 10 or 16, how does this work?

  7. #7
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Deleting rows if value is or is not in several columns?

    It doesn't work that way; this would

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1