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

  • Need VBA code to do following

    1. Unprotect active sheet with known password

    2. Run spell check

    3. Protect active sheet with known password while allowing row formatting in protected mode

  • My Skill Level: Beginner

    Where am I going wrong?

    ActiveSheet.Unprotect Password:=“1234”

    Cells.Checkspelling SpellLang:=1033

    ActiveSheet.Protect Password:=“1234”, True, 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

    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!