VBA – Check Spelling



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

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

sheet1.CheckSpelling

expression is a reference to the range or object to check the spelling of.

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