UPPERCASE ENTRY

craigwojo

Active Member
Joined
Jan 7, 2005
Messages
279
Office Version
  1. 365
Platform
  1. Windows
Is there a way to automatically have a UPPERCASE entry (even if the keyboard is set to lowercase) in a cell?

Thank you and God bless,
Craig
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Yes, you can use VBA to do that.

Right-click on the sheet tab name at the bottom of the screen, select "View Code", and paste this VBA code in the VB Editor box that pops up:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    Application.EnableEvents = False
    Target.Value = UCase(Target.Value)
    Application.EnableEvents = True
End Sub
Then, as long as you have VBA/Macros enabled on your workbook, whenever you make an entry in that worksheet, it will automatically make it all upper case.

If you want to restrict this to certain range(s) on your sheet, we can do that, if you provide those details.
 
Upvote 0
Thank you Joe4,
What about a column in a spreadsheet? Let's say all the cells in column B after B4.

Thank you.
 
Upvote 0
Thank you Joe4,
What about a column in a spreadsheet? Let's say all the cells in column B after B4.

Thank you.
You can do that like this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if more than one cell updated at a time
    If Target.CountLarge > 1 Then Exit Sub
    
'   Check to see if entry is made in cell B4 or below
    If Target.Column = 2 And Target.Row >= 4 Then
        Application.EnableEvents = False
        Target.Value = UCase(Target.Value)
        Application.EnableEvents = True
    End If
    
End Sub
 
Upvote 0
Solution
You can do that like this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if more than one cell updated at a time
    If Target.CountLarge > 1 Then Exit Sub
  
'   Check to see if entry is made in cell B4 or below
    If Target.Column = 4 And Target.Row >= 2 Then
        Application.EnableEvents = False
        Target.Value = UCase(Target.Value)
        Application.EnableEvents = True
    End If
  
End Sub
Hi Joe,
Everything works great. (Remember I'm a newbie with VBA).
I want to add another area to make CAPS within a cell.
I copied the VBA and added it to the bottom of yours and changed "If Target.Column = 2 And Target.Row >= 4 Then" and got an error.
How do I add another area to the VBA without getting an error? Maybe later on I might need to add another area for CAPS and I don't want to bother you with any little change or addon to this spreadsheet.

Your assistance is more than just appreciated. Thank you and God bless,
Craig
 
Upvote 0
Just use an Or statement something like the below

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)

'   Exit if more than one cell updated at a time
    If Target.CountLarge > 1 Then Exit Sub
    
'   Check to see if entry is made in cell B4 or below
    If Target.Column = 2 And Target.Row >= 4 Or Target.Column = 5 And Target.Row >= 6 Then
        Application.EnableEvents = False
        Target.Value = UCase(Target.Value)
        Application.EnableEvents = True
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,225,760
Messages
6,186,868
Members
453,380
Latest member
ShaeJ73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top