+ Reply to Thread
Results 1 to 6 of 6

How to check if two cells in a range of four are not blank?

  1. #1
    Forum Contributor
    Join Date
    10-22-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    162

    How to check if two cells in a range of four are not blank?

    Hi,

    Bit of a theory based question here.

    I have a row of four cells and I want to run some code only if two of these cells are not blank.
    The only possible outcomes are:
    • all cells empty
    • all but one cell empty
    • all but two cells empty

    Obviously I could build a messy if statement using Or's and And's to check for each of the possible possitive criteria matches (e.g: If A1 and B1 <> "" or A1 and C1 <>"" or A1 and D1 <>"" or B1 and C1 <>""... etc), but I was wondering if there's a neater way to do this...

    Always looking to improve, any ideas appreciated.

    Thanks, TC

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: How to check if two cells in a range of four are not blank?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    10-22-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    162

    Re: How to check if two cells in a range of four are not blank?

    That looks like a nice idea! Thank you.

    I have a bit more code to write then I'll incoporate the above (couple of other criteria to check) and confirm back as solved.

    Thanks again, TC

  4. #4
    Forum Contributor
    Join Date
    10-22-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    162

    Re: How to check if two cells in a range of four are not blank?

    Appologies for the delay - the other bits took a bit longer than expected!

    I'm having a bit of trouble with this code, it's returning an "Object doesn't support..." error:

    Please Login or Register  to view this content.
    I've checked each of the items that build up the range and they're returning the correct values (10,33:10:36 for example).
    Am I trying to do too much in this one line of code?

    Any help appreciated. TC

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: How to check if two cells in a range of four are not blank?

    it's .worksheetfunction not .worksheetfunctionS!

  6. #6
    Forum Contributor
    Join Date
    10-22-2012
    Location
    London, UK
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    162

    Re: How to check if two cells in a range of four are not blank?

    Doh! Thanks. #feelinglikeadoofus!

+ 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. Before save event and check if any cells in the specific range are left blank
    By Khowailedg in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-26-2013, 01:33 PM
  2. Replies: 15
    Last Post: 04-25-2012, 05:21 PM
  3. Replies: 2
    Last Post: 02-24-2012, 06:23 AM
  4. Advanced filter with blank cells / Dynamic named range with blank cells
    By Jason_2112 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2010, 12:06 PM
  5. Replies: 6
    Last Post: 04-09-2010, 08:46 AM

Tags for this Thread

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