Capitalize text upon entry in a cell

  • Thread starter Thread starter Michael Lanier
  • Start date Start date
M

Michael Lanier

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
 
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.
 
Back
Top