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

Hanging Indents in Wrapped Text

If you use hanging indents for some of your paragraphs, you may wonder why they don't look right when they wrap on the ...

Discover More

Indenting a Paragraph

Normally your text extends from the left margin all the way to the right. If you need to indent a paragraph of your text, ...

Discover More

Printing Selected Worksheets

When you accumulate quite a few workbooks in a folder, you might need to print out selected worksheets from all of the ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Changing Fonts in Data Validation Drop-Down Lists

The data validation capabilities of Excel allow you to easily create drop-down lists showing what data is acceptable for ...

Discover More

Limiting Entries to Numeric Values

When creating a worksheet, you may need to limit what can be entered into a particular cell. Using data validation, you ...

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
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 8 + 7?

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.