Mimicking Small Caps in Excel

by Allen Wyatt
(last updated April 29, 2017)

3

Conrad would like to mimic the "small caps" capability of Word within Excel. The only way he can think to do this is to develop a macro that steps through every character in a cell. If the character is lowercase and 11 pt, then the macro should change the character to uppercase 9 pt. If the character is uppercase (or not a letter), then it should not be affected. Problem is, Conrad doesn't know how to affect the formatting of individual characters in the cell in the manner described.

When using a macro to affect only certain characters within the cell, it is good to remember that each cell has its own Characters collection that can be accessed and modified. Each element in the collection represents, as you might expect, a single character in the cell.

This allows us to put together a macro that examines what is currently in the cell, and if the character is currently lowercase, convert just that character to uppercase and reduce that character's font size.

Sub SmallCaps()
    Dim rCell As Range
    Dim sWords As String
    Dim sCharacter As String
    Dim x As Long

    'go through each cell in selection
    For Each rCell In Selection
        'Don't want to work on formulas
        If Not rCell.HasFormula Then
            sWords = rCell.Value 'Get the cell contents
            For x = 1 To Len(sWords) 'Act on each letter
                sCharacter = Mid(sWords, x, 1)
                If sCharacter >= "a" And sCharacter <= "z" Then
                    'sCharacter is a lowercase letter
                    With rCell.Characters(Start:=x, Length:=1)
                        'Decrease the font size by 2
                        .Font.Size = .Font.Size - 2
                        'Make character uppercase
                        .Text = UCase(sCharacter)
                    End With
                End If
            Next
        End If
    Next
End Sub

This macro does its work on whatever cells are selected when it is run. It checks to make sure the cell doesn't contain a formula (formulas are skipped), and then it makes any modification to lowercase characters in the cell.

There are drawbacks to using a macro such as this, and you should be aware of them. The biggest drawback is that it actually modifies what is in the cells. When it is done, the cells will contain all uppercase text, even though the formatting may make it look like small caps. This means that you may have problems when you later run the macro a second time, and Excel's proofing tools (such as the spell checker) won't work on words that are all uppercase. (Excel can, however, be configured to still spell check such words.)

Because of the drawbacks, you may want to take an entirely different approach—change the font you use for the cells in which you want small caps. If you search the web for a "small caps fonts" (without the quote marks) you should be able to find many candidates, and a good number of them are available for free. Here is one site that may have something you like:

https://www.fontsquirrel.com/fonts/list/tag/small%20caps

Just download the font you want (from this or any other reputable source) and install it on your system. When you restart Excel, the font should be available for formatting cells. Cells formatted to use such a font would show text as small caps, even though the actual cell contents are a mixture of upper- and lowercase.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (653) applies to Microsoft Excel 2007, 2010, 2013, and 2016.

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

Applying Styles in Word 6 through Word 2000

How to apply styles to your document elements.

Discover More

Printing Reports

The Report Manager allows you to create specialized reports that can be easily printed from your worksheet data. This tip ...

Discover More

Enabling Safe Mode

Safe Mode is an essential way to regain control of a system that fails to fully boot. Windows 10 doesn't come with a way to ...

Discover More

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!

More ExcelTips (ribbon)

Problems with Custom Views

If you get an error when you try to use one of your custom views, it could be due to the protection you have applied to the ...

Discover More

Matching Formatting when Concatenating

Convert a numeric value to text and you may be surprised by how Excel displays the value. Here's a run-down on exactly what ...

Discover More

Setting Cell Width and Height Using the Keyboard

Hate to take your hands off the keyboard? Here are a couple of ways you can reject the mouse and still adjust the height and ...

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}] 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 seven minus 2?

2017-05-01 10:08:44

Jeaux

I LOVE this tip. Thank you.


2017-04-30 00:26:32

Theo Deed

Beautiful.


2017-04-29 12:25:56

Sheryl Lucas

Using a small caps font Is an OK solution if the file will only be viewed on one computer. Be aware, though, that if the file is opened on other computers that don't have that font installed, the file will display in said computer's default font.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu 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.