+ Reply to Thread
Results 1 to 5 of 5

How to check for 2 criteria for an action

  1. #1
    Registered User
    Join Date
    08-29-2016
    Location
    San Diego, CA
    MS-Off Ver
    Office 2016
    Posts
    5

    How to check for 2 criteria for an action

    Hello everyone, I'm fairly new to macros and I need your help.

    How do I check for 2 criteria in the same row and have an action based on that criteria?

    What's the macro we would use in the sheet that deletes the row if both columns B and C contain 0 but leaves it alone if it is blank throughout the entire sheet without hard coding?

    Example:

    2016-08-29_18-38-47.png

    Thank you!

  2. #2
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

    Re: How to check for 2 criteria for an action

    Hi 2shlee and welcome to the forum,

    Here's an code example that will delete rows where B and C = 0
    (only if there is a value in B and C)

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: How to check for 2 criteria for an action

    Different approach, same result (I think).

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-29-2016
    Location
    San Diego, CA
    MS-Off Ver
    Office 2016
    Posts
    5

    Re: How to check for 2 criteria for an action

    Quote Originally Posted by jolivanes View Post
    Different approach, same result (I think).

    Please Login or Register  to view this content.
    This worked, but the code is very peculiar.

    So I ran the Macro and it did as it's supposed to. I added additional lines below with new names and criteria of 0 & 0 for both column B and C and all the sudden it didn't run properly (do as intended). Why is this the case?

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: How to check for 2 criteria for an action

    Don't know. I don't have your workbook to check. As long as it is zero's (0) and not capital o's (the alphabet 15th letter), it should work I would say.
    How about GC Excel's code. Use it if that works OK.
    How are the zero's entered?
    Just for the heck of it. I tried again and added a bunch with zero's in Column B and C and it worked OK.
    Last edited by jolivanes; 08-30-2016 at 06:48 PM.

+ 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. Can't figure out the formula I need to query by multiple criteria/send action
    By telecomladyj in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-15-2015, 02:50 PM
  2. My Action Tracker Keeps placing my competed action rows on sheet2 in the same place.
    By billybong33 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-18-2014, 04:01 PM
  3. conditional check, action, then continue
    By Xtopher in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2013, 07:47 PM
  4. [SOLVED] check the latest day (col 1) referring to action (col 2) and return the value from Col 3
    By meteorro in forum Excel Formulas & Functions
    Replies: 30
    Last Post: 12-02-2012, 01:46 PM
  5. Macro to loop through rows, if criteria is met then certain action is performed
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 06-08-2011, 04:20 PM
  6. [SOLVED] check for insert row action...
    By mark kubicki in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2006, 08:10 PM
  7. Replies: 1
    Last Post: 07-19-2005, 11:05 PM

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