Automatically change text to uppercase

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a data sheet to be completed by other users. I would like to
format the text cells (name, etc) to have text entered as uppercase
automatically although the user might use title or lower case.

UPPER function cannot make cell look at itself and perform the function

Excel 2003
 
You could use this VBA-code:

Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range("A1:B10")
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next
End Sub

It'll have to be run after the data has been entered.
 
Santie

"Automatic" would require VBA code.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column > 8 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

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

Copy/paste the above code into that module.

Note: as written it operates only on Columns A through H.

Change the > 8 to something else if you require more or less columns.


Gord Dibben Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top