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
Solved

Yes or No

Posted on 2011-03-04
3
770 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
3 Comments
 
LVL 12

Assisted Solution

by:sdwalker
sdwalker earned 200 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 300 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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

808 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