How to force text string to uppercase / lowercase / proper case in Excel?
In Excel, when you enter some letters or words into the cells, you want to force the text strings to uppercase even though you entered the lowercase or proper case letters and vice versa. Most of us may consider the Data Validation feature in Excel, with this function, we will get a warning when we don’t type the correct case of the text. In this article, I will introduce some interesting ways to force the text to uppercase, lowercase or proper case as you need.
Change Case (Change text case to UPPERCASE, lowercase, Proper Case or Sentence case...)
Recommended Productivity Tools for Excel
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 71% of your time and solve 82% Excel problems for you. 300+ advanced tools designed for 1500+ work scenario, make Excel much easy and increase productivity immediately.60-day Unlimited Free Trial
Data Validation is a powerful tool in Excel, it can help us to do many operations, with its help, we can also force the uppercase, lowercase or proper case of the text strings when typing, please do as follows:
1. Go to click Data > Data Validation > Data Validation, see screenshot:
2. In the Data Validation dialog, under the Settings tab, click the Allow drop down list and choose Custom option, then in the Formula text box, enter this formula =EXACT(UPPER(A1),A1), (A1 stands for a column that you will apply this feature, you can change it to your need ), see screenshot:
3. Then you can create an alert as you need, please click Error Alert tab, and select Stop from the Style drop down list, at the right corner of the Error message text box, enter your own warning message, see screenshot:
4. And then click OK to close the dialog, now when you enter the text string not in uppercase in column A, a warning box will pop out to remind you entering the uppercase letters.
If you need to force the text strings to lowercase or proper case, please apply the following formulas into the Data Validation in step 2.
Force to lowercase: =EXACT(LOWER(A1),A1);
Force to proper case: =EXACT(PROPER(A1),A1)
With the following VBA code, when you enter the lowercase words into a cell, the lowercase text will be changed to the uppercase letters automatically.
1. Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.
2. Then choose your used worksheet from the left Project Explorer, double click it to open the Module, and then copy and paste following VBA code into the blank Module:
VBA code: Force text string to uppercase
Private Sub Worksheet_Change(ByVal Target As Range) 'Update 20140603 Target.Value = VBA.UCase(Target.Value) End Sub
3. Then save and close this code to return to the worksheet, now when you enter text string whenever it is lowercase or proper case, it will become uppercase after tapping the Enter key automatically.
1. This code is applied to the whole worksheet.
2. If you cannot find the Project Explorer Pane in the window, you can click View > Project Explorer to open it.
3. To force the words lowercase or proper case, you can apply the following VBA code: (The procedure is the same as the above)
VBA code: Force text string to Lowercase
Private Sub Worksheet_Change(ByVal Target As Range) 'Update 20140603 Target.Value = VBA.LCase(Target.Value) End Sub
VBA code: Force text string to proper case
Private Sub Worksheet_Change(ByVal Target As Range) 'Update 20140603 Target.Value = Application.WorksheetFunction.Proper(Target.Value) End Sub
If you just want to change some specific texts into UPPERCASE, lowercase or Proper Case, you can apply the Change Case utility of Kutools for Excel to quickly get it done.
|Kutools for Excel, with more than 120 handy Excel functions, enhance your working efficiency and save your working time.|
After free installing Kutools for Excel, please do as below:
1. Select the texts you want to change case and click Kutools > Text > Change Case. See screenshot:
2. In the Change Case dialog, check the operation option as you need, and you can preview the result in the Preview pane. See screenshot:
3. Click Ok or Apply and the texts have been change case.
Change to UPPERCASE Change to Proper Case Change to Sentence case
Change Sige of Vlaues (quickly change negative to positive values, or vice versa...)
Recommended Productivity Tools
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 6 months agoThis worked for me, however if you went to delete the contents of the cell then a "runtime error '13': type mismatch" came up
To post as a guest, your comment is unpublished.· 1 years agoLike your VBA solution, but how could I limit it to a single column and format other columns differently, e.g., columns A and C force uppercase, column B force proper case?
To post as a guest, your comment is unpublished.· 3 years agothanks for the macro to convert all entries to capital letters, but is there something i need to do to stop the macro from crashing excel every fe minutes?
Appreciate the help!