Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Forcing Input to Uppercase.
by Allen Wyatt
(last updated February 6, 2016)
If you are developing a worksheet for others to use, you may want them to always enter information in uppercase. Excel provides a worksheet function that allows you to convert information to uppercase, but it doesn't apply as people are actually entering information. For instance, if someone enters information in cell B6, then the worksheet function can't be used for converting the information in B6 to uppercase.
Instead, you must use a macro to do your changing for you. When programming in VBA, you can force Excel to run a particular macro whenever anything is changed in a worksheet cell. The following macro can be used to convert all worksheet input to uppercase:
Private Sub Worksheet_Change(ByVal Target As Range) With Target If Not .HasFormula Then .Value = UCase(.Value) End If End With End Sub
For the macro to work, however, it must be entered in a specific place. Follow these steps to place the macro:
Now anything (except formulas) that are entered into any cell of the worksheet will be automatically converted to uppercase. If you don't want everything converted, but only cells in a particular area of the worksheet, you can modify the macro slightly:
Private Sub Worksheet_Change(ByVal Target As Range) If Not (Application.Intersect(Target, Range("A1:B10")) Is Nothing) Then With Target If Not .HasFormula Then .Value = UCase(.Value) End If End With End If End Sub
In this particular example, only text entered in cells A1:B10 will be converted; everything else will be left as entered. If you need to have a different range converted, specify that range in the second line of the macro.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2568) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Forcing Input to Uppercase.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Need to limit the number of characters that can be entered into a cell? One easy way to do it is through the use of Data ...Discover More
Excel's Paste Special command is used quite a bit. If you want to create some shortcuts for the command, here's some ways ...Discover More
As you are entering data in a worksheet, Excel can monitor what you type and make corrections for common mistakes. One ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.