?
Solved

Yes or No

Posted on 2011-03-04
3
Medium Priority
?
784 Views
Last Modified: 2012-05-11
Experts,
I've looked at data validation and it is not getting me what I need.

In my spreadsheet from H12:H22 the user can only type in a yes or a no. Anything else is not allowed. The yes and no needs to be capitlaized regardless of how the user enters it. I've looked at the Workbook_Change event.
0
Comment
Question by:Frank Freese
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Assisted Solution

by:sdwalker
sdwalker earned 800 total points
ID: 35037997
Data Validation DID work for me.  Select to Allow a list and for the Source, type in "YES,NO" (without the quotes).

It restricts the answers to capital YES and NO.
0
 
LVL 39

Accepted Solution

by:
nutsch earned 1200 total points
ID: 35037998
Hi, this code should do it:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cl As Range

Application.EnableEvents = False
If Not Intersect(Target, Range("H12:H22")) Is Nothing Then
    For Each cl In Intersect(Target, Range("H12:H22")).Cells
        If UCase(cl) <> "YES" And UCase(cl) <> "NO" Then
            cl.ClearContents
        Else
            cl = UCase(cl)
        End If
    Next
End If
Application.EnableEvents = True
End Sub

Open in new window


Thomas
0
 
LVL 6

Expert Comment

by:FernandoFernandes
ID: 35038135
sdwalker's suggestion is indeed the cleanest, and works as you want...
but as far as I understand, the user is somehow supposed to be able to enter "yes", butyou want this to be converted to "YES", right ?
in this case, nutsch solution is the most appropriate... but it will put VBA in your file... means, you get what you want, but as a "gift" you'll always have to enable macros...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question