+ Reply to Thread
Results 1 to 7 of 7

Check if ANY cell in range is empty

  1. #1
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Check if ANY cell in range is empty

    Hi, me again,

    I have a chunk of code to loop through a range of 30 cells and check for null values. Various cells will contain text, numbers, and time/date data. Basically, I need to validate that all required fields in a form contain a value. I don't care what value at this point, I'll handle that with built in data validation.

    I am using the following code:

    Please Login or Register  to view this content.
    This approach is working but the loop triggers the MsgBox for each empty cell. So, if all cells are blank, the user has to click out of the message box 30 times. Is there another approach that would only trigger the message box once and bailout of the procedure if ANY empty cell is found? Thanks for the help.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Check if ANY cell in range is empty

    Hello TFiske,

    Please try; (Untested)

    Please Login or Register  to view this content.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Check if ANY cell in range is empty

    I figured it out:

    Added Exit sub after the MsgBox line:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check if ANY cell in range is empty

    Try:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  5. #5
    Forum Contributor
    Join Date
    03-30-2016
    Location
    Gillette, WY
    MS-Off Ver
    Office 365
    Posts
    230

    Re: Check if ANY cell in range is empty

    Hey, thanks. I just figured out the same solution and tested it. It's working. I appreciate the quick response though. Reps to you!

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Check if ANY cell in range is empty

    You're welcome and thanks for the rep!

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Check if ANY cell in range is empty

    You're welcome, glad we could help and 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] Check if value is in range, and if so check cell on row empty
    By tool_fairy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-21-2017, 10:35 AM
  2. Check for multiple range and if any cell is not empty do something
    By tohor in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-31-2017, 12:24 PM
  3. Check for empty cell in a range of #N/A cells
    By Ramo13541 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-08-2016, 05:27 AM
  4. Check range A10 to A45 and if cell not empty then same line in B must have value
    By CAVA30 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-08-2013, 09:25 PM
  5. Check for each cell in range if is it empty when user click to some cells
    By cronet in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-01-2013, 04:35 PM
  6. Check if any cell ina range is empty then kill macro
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-18-2011, 03:17 PM
  7. check if any cell in a dynamic range is empty
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2008, 04:13 PM

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