Return to VBA Code Examples

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

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

Learn More!


<<Return to VBA Examples

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

Return to VBA Code Examples