Auto Formatting a cell to change text to all CAPS.

Eric Livesay

Board Regular
Joined
Feb 13, 2008
Messages
127
How can I format a cell to automatically change any entered text to all capital letters?

Thanks, Eric.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You won't do this via formatting but some simple code would work. Paste the following into the relevant sheet module:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Value = UCase(Target.Value)
End Sub
 
Upvote 0
Thanks njimack,

One question...how do i access the sheet module? Is it a macro or VBA? I tried using a macro but I'm not completely competent with macros.

Thanks, Eric.
 
Upvote 0
Access the sheet module by Right_Clicking the sheet tab and choosing "View Code"

lenze
 
Upvote 0
Exactly what I needed, except for one thing...

I get a Microsoft Visual Basic error when ever I delete something from a cell:

Run-time error '13':

Type mismatch

With the options to 'End' 'Debug' 'Help'

When I click Debug it highlights in yellow the following part of your code:

Private Sub Worksheet_Change(ByVal Target As Range)
-->Target.Value = UCase(Target.Value)
End Sub

How can I fix this?


Thanks, Eric.
 
Last edited:
Upvote 0
Oops!

Try this:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 0
Target.Value = UCase(Target.Value)
End Sub
 
Upvote 0
Nope, same error.

It's still getting a type mismatch error.

It's pointing to this part of your code:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 0
-->Target.Value = UCase(Target.Value)
End Sub

There are some formulas on the sheet, does that make a difference?
 
Upvote 0
OK, 3rd time lucky. This code tests whether the target cell contains a formula. It also tests that only one cell is selected.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo 0
    If Target.HasFormula = False And Target.Count = 1 Then Target.Value = UCase(Target.Value)
End Sub
 
Upvote 0
I will apologize in advance for my complete lack of Excel knowledge when asking this question. I am trying to change everything in my sheet to uppercase letters. I did like one of the previous posts said and entered the code but I got this response:

The following features cannot be saved in macro-free workbooks:
-VB project
To save a file with these features, click No, and then choose a macro-enabled file type in the File Type list.
To continue saving as a macro-free workbook, click Yes.

Can someone please advise me here?

I came into an already established Access database imported from our retail system which we also have a branch of Excel for email addresses. The jist, is that for USPS purposes, everything needs to be in uppercase letters. There are hundreds upon hundreds of entries in the Excel file that are not uppercase.

Thanks!!
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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