Written by Allen Wyatt (last updated July 29, 2023)
This tip applies to Excel 97, 2000, 2002, and 2003
If you use worksheets that have quite a bit of text in them, there may be times you long for a function like Word has that easily converts between upper and lower case. Excel contains such functions, but they are designed to be used in macros, not as commands from the menus.
If you want to quickly convert large ranges of text without the need to retype the text in the cells of the range, you can use the following macro:
Sub MakeUpper() Dim MyText As String Dim MyRange As Range Dim CellCount As Integer Set MyRange = ActiveSheet.Range(ActiveWindow.Selection.Address) For CellCount = 1 To MyRange.Cells.Count If Not MyRange.Cells(CellCount).HasFormula Then MyText = MyRange.Cells(CellCount).Value MyRange.Cells(CellCount).Value = UCase(MyText) End If Next CellCount End Sub
This macro steps through the cells in a range you select, converts the contents of any cell that does not contain a formula to uppercase. You can easily modify the macro so that it converts to lowercase by changing the UCase function (used near the bottom of the macro) to LCase. Another nifty modification is if you want to use title case instead of uppercase or lowercase. (Title case is where only the first letter of each word is uppercased.) To do this, replace UCase(MyText) with Application.Proper(MyText).
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1970) applies to Microsoft Excel 97, 2000, 2002, and 2003.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
You can hide a bunch of worksheets at the same time, but Excel makes it impossible to unhide a bunch at once. You can, ...
Discover MoreYou can, from within your macros, easily display a message box containing a message of your choice. If you want to ...
Discover MoreImport a bunch of ZIP Codes into Excel, and you may be surprised that any leading zeroes disappear. Here's a handy little ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments