Bonjour le forum.
J'ai une macro qui ne fonctionne pas en mode "partagé" (Erreur d'exécution '1004': La méthode Unprotected de la classe Worksheet a échoué).
Comment puis-je faire pour qu'elle fonctionne en mode "partagé"?
Voici la macro :
Dim l As Integer
Private Sub ANNULER_Click()
Unload Me
End Sub
Private Sub ComboBox1_Change()
Me.Label1 = [A:A].Find(Me.ComboBox1.Value).Offset(0, 1)
If Me.Label1 = "" Then Me.Label1 = 0
End Sub
Private Sub ENR_Click()
With Sheets("DAAF DEFAILLANTS")
.Unprotect Password:="DAAF" ' mot de passe à mettre entre les guillements
actualise = Application.Match(Me.ComboBox1.Value, .[A:A], 0)
.Cells(actualise, "B") = Me.TextBox1.Value + .Cells(actualise, "B")
.Protect Password:="DAAF", DrawingObjects:=True, Contents:=True, UserInterfaceOnly:=True
End With
Unload Me
End Sub
Private Sub UserForm_Initialize() ' complète le combobox avec les données colonne A
l = 5
Do While Sheets("DAAF DEFAILLANTS").Cells(l, "A") <> ""
Me.ComboBox1.AddItem Cells(l, "A")
l = l + 1
Loop
End Sub