Don't Allow Empty Cells

Written by Allen Wyatt (last updated November 4, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003


Merle is trying to use the Data Validation feature of Excel to limit what a user can choose in a cell. When the user activates a cell he only wants an answer of Yes, No, or N/A; he does not want the user to be able to get out of the cell and leave it blank (empty). Merle has set up a list for the acceptable values (Yes, No, and N/A) and has unchecked the Ignore Blanks check box when setting up the Data Validation.

The problem is that when someone activates the cell, it is possible for them to still leave it empty. The only time that Excel won't allow the person to leave the cell blank is if they start to edit the cell and try to leave it blank after the edit. Merle wants, once the cell is selected, for the user to absolutely only be able to leave the cell if they choose Yes, No, or N/A.

Data Validation, by itself, can't take care of this. There are a couple of ways that you can work around the problem, however. The first idea is to modify the options that you give the user. For instance, let's say that you add a fourth choice of "Provide Answer." You could then change the value in the cell to the same value and save your workbook. When the user opens it, the cell contains "Provide Answer" and, once they select the cell, they won't be able to blank it out; they will need to provide an answer.

Another option is to use a macro in conjunction with the Data Validation you have set up. The easiest method is to set up an event handler for each time the selection changes in the worksheet. The following example kicks into play if the cell selection is C22 (which is where your Data Validation should be, as well).

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim rng As Range
    Set rng = Range("C22")
    If Application.Intersect(Target, rng) Is Nothing Then
        MsgBox "You must select the answer from the list"
    End If
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8767) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Changing the Footnote Continuation Separator

When you add a really long footnote to a document, it could be that the entire footnote might not fit on the page where ...

Discover More

Summing Digits in a Value

Want to add up all the digits in a given value? It's a bit trickier than it may at first seem.

Discover More

Moving Drawing Objects

Add a drawing object to a worksheet and chances are good you'll need to move it in some way. Here's how to use the mouse ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (menu)

Limiting Input to a Format

When setting up a worksheet for others to use, you might want to make some limitations on what can be entered in certain ...

Discover More

Handling Validation for Proper Latitude

When setting up Excel for data entry, you often have to be concerned with what values are acceptable. For example, if ...

Discover More

Using Data Validation

Want to control what users put into a cell? It's easy to do using a feature called data validation, as described in this tip.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is five more than 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.