Spell Check In Excel Using Vba
Spelling check feature has been a staple in microsoft office products for a long time.
Spell check in excel using vba. Let us show you how to spell check in excel using vba. To check headers footers and objects on a worksheet use this method on a worksheet object. The following is example code to launch the spelling dialog box before a workbook closes but before asking to save.
Uses of spell check in excel. Below is the macro i use in vba to check the spelling of an excel doc. Sub spell me2 dim r as boolean if not application checkspelling word activecell text then activecell interior color vbyellow end if end sub.
Excel displays the spelling dialog box. This method has no return value. Can anyone help with this.
However i need to modify this to highlight the misspelled word so the user knows where the misspelled word is. Spell check can be done manually and also can be automated using vba code. 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.
Sub spell me dim r as boolean r application checkspelling word activecell text msgbox r end sub. Sub selectunlockedcells spellcheck activesheet unprotect password dim workrange as range dim foundcells as range dim cell as range set workrange activesheet usedrange. To check only cells and notes use this method with the object returned by the cells property.
For the code to work you must place it in the thisworkbook code window in vba. To check the spell we can either use shortcut function key f7 or from review menu tab we can use the spelling option under proofing. However this can be a bit tricky to use in excel.