mardi 5 septembre 2017

VBA: UserInterfaceOnly:=True is not working for Checkbox LinkedCell

I'm trying to allow a Checkbox to assign a TRUE/FALSE value to its LinkedCell on a protected sheet. As you can see below, anytime it locks the worksheet, it sets UserInterfaceOnly:=True. BUT, when I click the Checkbox, it gives me the exception message box that says it is a protected sheet.

Since the LinkedCell assigns the value immediately, there is no chance to toggle worksheet protection without utilizing a function to assign the TRUE/FALSE value. I'd like to avoid that if possible.

Am I missing something? I've looked at a few questions previously posted here on SO, but they don't seem to cover my issue.

Thanks

Sub ResetLogWorksheet()

    Sheet1.Range("C1").Value = ""

    'Lock entire worksheet except select manual entry cell
    With Sheet1
       .Unprotect Password:=GetProtectPassword()
       .Range("C1:O1").Locked = False
       .Protect Password:=GetProtectPassword(), UserInterfaceOnly:=True, AllowFormattingCells:=True
    End With

End Sub

Aucun commentaire:

Enregistrer un commentaire