Auto Upper Case

  • Thread starter Thread starter jamphan
  • Start date Start date
J

jamphan

Is it possible to have cells to automatically change the text to all
Upper case. I know there is a formula but I want it to change when the
user types in text and goes to another cell it will change to all caps.
 
The only way to do what you want is with a macro. This article describes
how a Selection_Change macro works:

http://support.microsoft.com/kb/305565/en-us

but, instead of the code in step 4, you've have:

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

'Set the range for the formatting changes to A1:A5.
Set r = Intersect(Range("A1:A5"), Target)

'If the change in the worksheet is not in the tested range, exit the
macro.
If r Is Nothing Then Exit Sub

'Change for uppercasing:
Application.EnableEvents = False
r.Value = UCase(r.Value)
Application.EnableEvents = True

End Sub

In the above code only cells in the range A1:A5 would be uppercased. If you
wanted the entire sheet affected you'd get rid of the Set and If lines and
use Target.Value = UCase(Target.Value)

--
Jim
message |
| Is it possible to have cells to automatically change the text to all
| Upper case. I know there is a formula but I want it to change when the
| user types in text and goes to another cell it will change to all caps.
|
|
| --
| jamphan
| ------------------------------------------------------------------------
| jamphan's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=20105
| View this thread: http://www.excelforum.com/showthread.php?threadid=498428
|
 
Back
Top