Format Cells to Capital Letters

J

John

Can you format a cell so that regardless of how you type the letters into the cell it will format it to capitals?
 
G

Gord Dibben

John

Cannot do this via formatting.

You can enforce CAPS by using Data Validation, but this would just make the
user have to re-key.

Either make sure Caps Lock is on or use event code in the worksheet.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Target.Cells = Range("A1") Then Exit Sub
'for a column use this next line
' If Target.Column <> 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

Right-click on sheet tab and "View Code".

Copy/paste the above code into the sheet module.

Gord Dibben Excel MVP
 
Top