Forum Discussion

JoeyD369's avatar
JoeyD369
Copper Contributor
Mar 10, 2022

Excel - Form control staying locked when worksheet protected

Hi There,

I have a spreadsheet with a Form Control spin button. When I protect the worksheet, the spin button stays locked even though I unticked the "Locked" option in the format control. I do have a small macro running on the sheet, so I don't know if that's causing a problem with the protection function. I can't choose the "Edit objects" option in the protection list because I have graphic objects on the sheet that need to stay protected. Please help! I need to share this spreadsheet with all staff so leaving it unlocked is not an option.

Cheers,

jo

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    JoeyD369 

    Add password unlock at the beginning of the macro and password protection at the end.

    See the VBA example.

     

    sub macro()
    Worksheets("sheet name").unprotect Password:="test"
    
    your macro statement
    
    
    Worksheets("sheet name").Protect Password:="test"
    end sub 

     

     

    Hope I was able to help you with this info.

     

    NikolinoDE

    I know I don't know anything (Socrates)

    Was the answer useful? Mark them as helpful!

    This will help all forum participants.

     

Resources