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.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Addresses used in a formula can be either relative or absolute. If you need to switch between the two types of ...
Discover MoreYou can assign your macros to a series of custom toolbar buttons, but you may only want those buttons to be visible when ...
Discover MoreWhen developing a macro, you may want to display on the status bar what the macro is doing. Here's how to use this ...
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