ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capitalize text upon entry in a cell (https://www.excelbanter.com/excel-programming/433841-capitalize-text-upon-entry-cell.html)

Michael Lanier

Capitalize text upon entry in a cell
 
Is there a macro that will capitalize text entered into a cell? Most
of the time the text will be in a range such as A1:C3. Thanks for
your help.

Michael

Rick Rothstein

Capitalize text upon entry in a cell
 
My response assumes that you want to make all the letters of a cell within
the specified range upper case immediately after hitting the Enter key for
the entry in that cell.

First off, you have to decide on the range of cells to apply this
functionality to (it can't be "most of the time"... it has to be all of the
time). I'll assume for this response that the range of cells is A1:C3 as you
mentioned. Right click the tab at the bottom of the worksheet that is to
have this functionality, select View Code from the popup menu that appears
and then copy/paste the following into the code window that you were taken
to...

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:C3")) Is Nothing Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
End Sub

Now, go back to the work sheet and type something into any cell in the range
A1:C3... as soon as you hit the Enter key, the text you typed in will become
capitalized.

--
Rick (MVP - Excel)


"Michael Lanier" wrote in message
...
Is there a macro that will capitalize text entered into a cell? Most
of the time the text will be in a range such as A1:C3. Thanks for
your help.

Michael



Michael Lanier

Capitalize text upon entry in a cell
 
Your solution works great. Thanks.

Michael


All times are GMT +1. The time now is 12:44 PM.

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