Converting Text Case

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:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (1970) applies to Microsoft Excel 97, 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Adding Borders to Paragraphs

Want to draw attention to a particular paragraph? A great way to do it is with a border. Word allows you to easily add ...

Discover More

Text Doesn't Wrap at Margin in Normal View

If you are using Word in Normal view, and the text on the screen doesn't wrap at the right margin like it should, the ...

Discover More

Working with Record Numbers

Want to keep track of various rows in a data table through the use of record numbers? Here are some options and ...

Discover More

Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!

More ExcelTips (menu)

Extracting Proper Words

If you've got a list of potential words, and you want to know which of those potential words are real, you'll appreciate ...

Discover More

Counting Cells with Text Colors

Got a bunch of cells that have different colored text in them? Here's a great way to count the occurrences of certain ...

Discover More

Pulling Cell Names into VBA

Excel allows you to define names that can refer to either ranges of cells or to constant information, such as formulas. ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 + 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.