ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Upper Case (https://www.excelbanter.com/excel-discussion-misc-queries/63354-auto-upper-case.html)

jamphan

Auto Upper Case
 

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...o&userid=20105
View this thread: http://www.excelforum.com/showthread...hreadid=498428


Jim Rech

Auto Upper Case
 
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
"jamphan" wrote in
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...o&userid=20105
| View this thread: http://www.excelforum.com/showthread...hreadid=498428
|




All times are GMT +1. The time now is 11:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com