EXCEL - Force Uppercase?

TheBramble

Legendary member
Messages
8,394
Likes
1,170
I thought I could achieve forced uppercase in a cell by simply using custom formatting, but that doesn't seem to be a possibility.

Anyone have any ideas how to do this?
 
Use this VBA code to convert any entries on a particular sheet to uppercase:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Value <> "" Then
Target.Value = UCase(Target.Value)
End If

End Sub


hope that helps!
 
Pervaz said:
you could use the UPPER(celref) function
Not really. That will only work on a value in a separate cell. I want the value I'm inputting into a cell to be forced uppercase.


Sidinuk said:
Use this VBA code to convert any entries on a particular sheet to uppercase:
Ermmm.how do I get that into my spreadsheet and how do I configure it for just, say, one specific cell?
 
ok, revised code for one specific cell, in this case A1:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Value <> "" And Target = [A1] Then
Target.Value = UCase(Target.Value)
End If

End Sub


To add it:

go to the visual basic editor (tools,macro,visual basic editor)
double click on the sheet you want to add the code to in the Project window (should be in top left corner)
copy and paste the code in the big white space on the right
close the vba editor
enter a word in lower case into cell A1 on your sheet and see it change to uppercase as if by magic!
 
Top