How to Spell Check in Excel & VBA

This tutorial will demonstrate how to use spell check in Excel and in VBA.

Spell Check in Excel

Microsoft Excel offers a basic spelling function that can help you check your spelling on any spreadsheet that you produce. This function is very limited, in relation to the spell check function in Microsoft Word or Microsoft PowerPoint. The Microsoft Word and Microsoft PowerPoint’s spell check function underlines the misspelled words as you write, while the Microsoft Excel spell check function does not. The function in Microsoft Excel will only notify you of misspelled words if you run the spellcheck feature. Also, it does not identify grammatical errors.

How to use spell check in Microsoft Excel

It is very easy to check your spelling within Microsoft Excel:

1. Go to the ‘Review’ tab in the ribbon in the Excel spreadsheet.
2. In the ‘Review’ tab, activate the option ‘Spelling’ (found on the left hand side) to spell check the worksheet (or use the shortcuts ALT > R > S or F7 to activate Spelling).

check spelling in excel vba

3. Once the spell check is initiated, a Spell Check dialogue box will appear (shown below).

vba spell check before saving workbook

It is really important to understand the different options available in this dialogue box. Here are brief definitions of each of the available options:

Ignore Once: This option allows you to disregard a spell check error suggestion for a word once.
Ignore All: This option allows you to disregard a spell check error suggestion for a word indefinitely on the spreadsheet.
Add: This option allows you to add a word that spell check regards as an error to the Microsoft Excel dictionary, as long as the word is used correctly. This will make the word acceptable within Microsoft Excel and will no longer be deemed as a spell check error.
Change: This option allows you to select a suggestion for a spell check error in order to automatically correct the misspelled word. There may be more than one suggestion for the misspelt word. Select the suggestion that you would like to apply.
Change All: This option allows you to change all of the spell check errors that apply to the same misspelled word with the selected suggestion of your choice.

AutoCorrect: This option changes a misspelled word with your selected suggestion and adds it to the autocorrect list. This allows excel to automatically correct that same misspelled word to the selected suggestion.

The Spell Check dialogue box shows you suggestions to misspelled words. Clicking the ‘Change’ button will automatically correct the spelling.
highlight mispelled words in excel

You can also disregard the suggestions provided to you by simply clicking ‘Ignore Once’ or ‘Ignore All’ button.
Once the spell check is complete, an alert will notify you:
how to spellcheck in excel vba

Keyboard Shortcuts to Spell Check in Microsoft Excel

Press F7 to initiate the spell check feature. Alternatively, you can use the ALT Shortcut Alt > R > S.

PC Shortcut
F7
Mac Shortcut
F7

How to Spell Check Multiple (or All) Worksheets at Once

The spell check feature only applies to the spreadsheet that is active. However, there is a method that you can follow in order to apply the spell check function to multiple sheets at once:

Right-click on the name of your active spreadsheet.
A menu will appear with an option ‘Select All Sheets’.
Click ‘Select All Sheets’

spellcheck all worksheets in workbook

By clicking ‘Select All Sheets’, you group the spreadsheets together as one in order to run the spell check function on all of the worksheets in the workbook.

Instead of using ‘Select All Sheets’, you can also hold down CTRL and / or SHIFT to manually select multiple worksheet tabs to spell check multiple sheets at once. Then activating Spell Check will address the spell check errors identified in the first sheet going from left to right.

Once finished, you will be notified:
check spelling on entire workbook

How to Spell check using VBA



check spellingWhile Excel’s main function is not word processing, many spreadsheets can accumulate a large amount of text, and spell checking a worksheet is usually the last thing people think to of doing.

If your spreadsheets fall in this category, you might try some creative ways to launch Excel’s “SpellChecker” from code as a gentle reminder.

Launch Spellcheck from VBA

The syntax to launch the Spelling dialog box using the default settings:

sheet1.cells.CheckSpelling

Spell Check Before Closing Workbook (VBA BeforeClose)

The following is example code to launch the Spelling dialog box before a workbook closes, but before asking to save. The expression tells VBA to check the spelling of all the cells in Sheet1. For the code to work you must place it in the ThisWorkbook code window in VBA.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Sheet1.Cells.CheckSpelling
End Sub

Highlight Misspelled Words with a VBA Macro

At the beginning of this tutorial we mentioned that, unlike Word & PowerPoint, Excel does not underline misspelled words while you work. Instead you must run the spell check manually. However, you can create a macro that highlights all the cells containing misspelled words:

Sub Highlight_Misspelled_Words()
Dim cell as Range
For Each cell In ActiveSheet.UsedRange
  If Not Application.CheckSpelling(Word:=cell.Text) Then cell.Interior.ColorIndex = 6
Next
End Sub

This won’t automatically highlight misspelled cells as you work. However, you could program it to run based on a timer or before closing the workbook.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text

Stop searching for VBA code online. Try the Code VBA Add-in…


[convertkit form=4869294]


<<Return to VBA Examples
Did you find this tutorial useful? Then share it with your friends and colleagues:

AI Formula Generator

Try for Free