Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Spell-Checking in a Protected Worksheet.

Spell-Checking in a Protected Worksheet

by Allen Wyatt
(last updated February 14, 2015)

5

Craig has a protected Excel worksheet in which he would like to spell-check a specific cell. The problem, of course, is that the spell-checker cannot be run on a protected worksheet. So, the process of doing the desired spell-checking is to unprotect the worksheet, do the check, and then again protect the worksheet.

In order to have the macro complete these steps, you must know the password used to protect the worksheet. The following simple example assumes that the password is "mypass."

Sub SpellCheckCell1()
    With ActiveSheet
        .Unprotect ("mypass")
        .Range("A15").CheckSpelling
        .Protect ("mypass")
    End With
End Sub

You'll obviously need to change the password used in the macro to the one appropriate for your worksheet. You'll also need to change the cell being checked; this macro checks cell A15. If you would rather have the macro check whatever cell is selected when the macro is run, then you can change it in this manner:

Sub SpellCheckCell2()
    With ActiveSheet
        .Unprotect ("mypass")
        Selection.CheckSpelling
        .Protect ("mypass")
    End With
End Sub

Regardless of which macro you use, you can assign it to a shortcut key or a toolbar button in order to make it easy to run. (How you do these assignments has been discussed in other ExcelTips issues.)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10403) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Spell-Checking in a Protected Worksheet.

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

Creating Worksheets with a Macro

Using a macro to add worksheets to your workbook is easy. This tip provides two different methods you can use.

Discover More

Changing the Way Endnotes Are Numbered

Word is flexible on how it numbers your endnotes. This tip shows how easy it is to make the changes to the numbering system.

Discover More

Changing Body Text to a Heading

When working on a document in Outline view, you may need to change regular body text to a heading in the outline. It's easy ...

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)

Spell-checking Uppercase Words

Excel's spell-checker normally checks uppercase words for spelling. If your worksheet contains a lot of acronyms, you might ...

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 four less than 9?

2017-02-11 08:36:38

lloyd

Whilst this code completed a spell check, it does not tell the user the spell check has completed checking in the active cell, instead it continues to spell check the rest of the spread sheet. I only require specific cells to be spell checked.

Sub SpellCheckCell2()
With ActiveSheet
.Unprotect ("mypass")
Selection.CheckSpelling
.Protect ("mypass")
End With
End Sub


2015-08-14 05:24:13

FShaikh

Great stuff, many thanks!


2015-03-13 05:42:22

balthamossa2b

@Ron


May be overkill, but try adding to your code:

Application.DisplayAlerts = False
Application.EnableEvents = False


And don't forget to turn them on later.


2015-03-12 19:24:41

Ron Mercer

Allen,
Thanks for the tip but with either proposed macro is there a way to turn off the Excel prompt that appears after the macro is run "Do you want to continue checking at the beginning of the sheet?". If we only want to check the Active Cell it is pointless. If I want to predefine the cells to check I don't want the user going outside those cells.


2015-02-16 11:09:24

balthamossa2b

A note about the .Protect part since it gave me trouble last month: by default, .Protect allows you to select locked and unlocked cells, much like Review > Protect Sheet.

However, unlike the menu option .Protect doesn't remember the checked choices from past uses of the protection interface (Format cells, modify objects...). They need to be added in the code, which is easy since they are all optional parameters of .Protect.

So yeah, depending on what you want your users to do in a locked sheet you may want to better define your .Protect.


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.