Mimicking Small Caps in Excel

by Allen Wyatt
(last updated April 29, 2017)

5

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

Number Formatting Shortcuts

Keyboard shortcuts can save time and make developing a workbook much easier. Here's how to apply the most common of ...

Discover More

Exporting Black and White Charts

Excel's charts are normally created in color, but you can print them in black and white. You may be looking for a way to ...

Discover More

Pulling Access Information into Excel

If you have a lot of data stored in Access databases, you may want to get at that information using Excel. There are a ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Conditional Formatting with Data Imported from Access

If you want to apply a conditional format to data imported into Excel from Access, you may run into some difficulties ...

Discover More

Formatted Dates Appear Differently on Different Systems

When you format a date in a specific manner, you may be surprised to see that the format changes when you open the ...

Discover More

Specifying Superscript Text

Applying different formatting to the text within a cell can seem a bit confusing. This is certainly the case when it ...

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 9 + 2?

2018-02-15 06:50:47

Anonymous

Thanks – very useful.


2018-02-04 14:38:07

Luiz S

Allen
Thank you for the lesson. I am using Saniretro, a font with capital letters only, and your macro solved my problem:
(see Figure 1 below)

Figure 1. 


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.