VBA code to unprotect active sheet, then spell check, then protect while allowing row formatting

  • My Skill Level: Beginner

    Where am I going wrong?


    ActiveSheet.Unprotect Password:=“1234”

    Cells.Checkspelling SpellLang:=1033

    ActiveSheet.Protect Password:=“1234”, True, True

    DrawingObjects:=True,

    Contents:=True,
    Scenarios:=True,

    AllowFormattingRows:=True

  • Welcome to the Forum. I have added code tags for you please read the Forum Rules to understand why.


    What is the error you are getting? CheckSpelling will display a list of errors.


    This works for me


    Code
    Sub SpellCheck()
    Const PW As String = "1234"
    ActiveSheet.Unprotect Password:=PW
    
    UsedRange.Cells.CheckSpelling SpellLang:=1033
    ActiveSheet.Protect Password:=PW, DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, AllowFormattingRows:=True
    End Sub

    This will spellcheck and change error text to red


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!