force uppercase char

  • Thread starter Thread starter Bert
  • Start date Start date
B

Bert

In one column, I want to be able to enter an "x" or "X" and have it always
displayed as Upper Case. The end result for these cells is either an "X" or
nothing. I tried using validation for this, but if I enter something other
than a capital "X", I get an error message. Ideally I'd like to simply have
Excel reject invalid entries without issuing an error (or simply convert it
to an "X").
Thanks.
Bert
 
Hi Bert,

Not sure I understand you fully, but you could use some VBA for that. Right
click the sheet tab and select View Code, paste this on the right ..


Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Set rng = Me.Range("A1") 'Me is the Sheet
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, rng) Is Nothing Then Exit Sub
Application.EnableEvents = False
Select Case rng.Value
Case "x"
rng.Value = "X"
Case "X"
'nothing
Case Else
rng.ClearContents
rng.Select
MsgBox "I'm sorry, but that value is not acceptable."
End Select
Application.EnableEvents = True
End Sub


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top