Macro excel protection déprotection

Bonjour à tous,

J'ai ressorti une ancien macro Excel qui ne fonctionne plus Objet manquant code erreur 424
Si quelqu'un peut m'aider .ça bogue l'instruction souligné. Merci d'avance
Sub ToggleButton1_Click()

Dim MdP As String
If ToggleButton1 = True Then
ToggleButton1.Interior.ColorIndex = 3
Sheets("Feuil1").Protect "alain"
ToggleButton1.BackColor = &HFF&
ToggleButton1.Caption = "Déprotection"

Else
MdP = InputBox("Mot de passe ?", "Déblocage de la feuille")
If MdP = "alain" Then
Sheets("Feuil1").Unprotect "alain"
ToggleButton1.BackColor = &HFF00&
ToggleButton1.Caption = "Protection"
End If
End If

End Sub

2 réponses

  1. Bonjour,
    Chez moi, ca marche, avec Excel2013......
    0
    1. Je vais vérifier sur un excel 2007 sous windows car sur Excel Mac 2011 ça marche pas
      0
      1. Ok, je regarde sur MAC

        Par contre si c'est sur une feuille, pas possible, pas de controls Activex a dispo
        0