+ Reply to Thread
Results 1 to 7 of 7

If cell NOT equal to 'this' OR 'that' then delete entire row

  1. #1
    Registered User
    Join Date
    08-16-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    88

    If cell NOT equal to 'this' OR 'that' then delete entire row

    Hi guys,

    I have a simple line of code but not sure why it isn't doing what I want. I want to delete the entire row if the specified cell is NOT 'POD' or 'HUD'. I thought I had wrote it out correctly but it seems to delete every row no matter what the cell contains!

    Please Login or Register  to view this content.
    Any ideas?
    Thanks

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    Should it be AND rather than OR?

    BSB

  3. #3
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    Try change Or to And.

    Also
    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  4. #4
    Registered User
    Join Date
    08-16-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    88

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    Hi guys, I changed it to AND.. and now it works! Thanks :-)
    But it seems strange to me that I'm using and since the cell isn't POD & HUD, it either contains POD or HUD or something else

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    The logic, in English, goes like this:

    If the cell is not POD AND if the cell is not HUD, then delete row.


    In mathematics:

    ~(A OR B) = ~A AND ~B

  6. #6
    Registered User
    Join Date
    08-16-2016
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    88

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    Thanks guys :D

  7. #7
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: If cell NOT equal to 'this' OR 'that' then delete entire row

    Glad we could help. Thanks for the rep!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA delete the entire line if the cell equal to 0
    By shinpencil in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-20-2016, 05:08 AM
  2. VBA code to delete the FILTERED range and moving the cell up (dont Delete entire row)
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:48 AM
  3. Macro code to delete entire row if cell in column A is equal to a value
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2014, 02:54 PM
  4. Delete Row if equal to Cell
    By Dnass in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2013, 01:13 AM
  5. [SOLVED] Delete cell only with certain critria. Don't want to delete entire row, the celsl only
    By RobertOHare in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-16-2013, 04:18 AM
  6. Macro to delete entire rows where O2:O does not equal a date
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2011, 10:37 PM
  7. Delete Entire Row When Cell Not Equal
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2009, 02:23 AM

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