EXCEL - Force Uppercase?

TheBramble

Legendary member
8,395 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?
 

sidinuk

Established member
624 5
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!
 

TheBramble

Legendary member
8,395 1,170
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?
 

sidinuk

Established member
624 5
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!
 
 
AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock