Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

VBA Code to spellcheck protected workbook, but give message if there are no spel

ID: 3561121 • Letter: V

Question

VBA Code to spellcheck protected workbook, but give message if there are no spelling errors.

I am using this code on a protected worksheet, which works perfect if there are spelling errors.  The user clicks an assigned button - a box pops up showing mispelled words/suggestions.

But, if there are no spelling errors when you click the button nothing happens, which makes it seem like the button is not working.  How can I work in a message box pops to tell the user "There are no spelling errors". Thanks!

ActiveSheet.Unprotect Password:="xxx"
Cells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, AlwaysSuggest:=True, SpellLang:=2057 '1033
ActiveSheet.Protect Password:="xxx"

Explanation / Answer

)Perhaps a message when spellcheck is complete?>

If there are mistakes, spellcheck will allow you to make corrections before the msgbox pops up to indicate there are no more changes to be made.,

ActiveSheet.Unprotect Password:="xxx"
Cells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, AlwaysSuggest:=True, SpellLang:=2057 '1033
MsgBox "spellcheck is complete"
ActiveSheet.Protect Password:="xxx"