PDA

View Full Version : Solved: Format Cell with Upper Case



Cyberdude
11-28-2007, 10:44 AM
This seems like it should have a simple solution, but I can't figure out how to do it. I have a cell into which I will enter a single alphabetic character. I want to be able to enter a lower case letter and have it automatically changed to upper case. How can I set that up?? :dunno

unmarkedhelicopter
11-28-2007, 10:45 AM
hit caps lock

Cyberdude
11-28-2007, 10:46 AM
That's no good . . then everything I enter elsewhere will be upper case. Thanx for trying.

unmarkedhelicopter
11-28-2007, 10:52 AM
if you have a specific range in mind you could write code to do it.
on sheet change check range is within required then have values re-written as .value = UCase(.value)
that should be enough unless you want me to write the code for you ?

mdmackillop
11-28-2007, 12:30 PM
Here you go Sid

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then Target = UCase(Target)
End Sub

anandbohra
11-29-2007, 03:16 AM
Same question asked by me earlier & XLD replies it & gave below mentioned solution

http://www.vbaexpress.com/forum/showthread.php?t=15894

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "B4:B30" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If Not .HasFormula Then
.Value = UCase(.Value)
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Cyberdude
11-30-2007, 12:19 PM
Nice solutions, guys! I guess I was hoping for a non-VBA solution, but you have essentially said "there isn't one". So I suppose I'll settle for the VBA approach.
Thanx again, gang. :friends: