Bonsoir et santé a tous.
J'ai inséré dans mon classeur Excel 2019 la macro suivante.
Est il possible de cliquer sur un bouton pour l'activer et si oui comment précéder ?
Pour l'instant je mis oui ou non dans A1 mais un point à cliquer serait plus pratique.
Merci d'avance
Rubens
La voici :
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "NON" Then
ActiveSheet.Unprotect
Range("A11:O11").Select
Selection.Locked = True
Selection.FormulaHidden = False
Range("A1").Select
ActiveCell.FormulaR1C1 = "OUI"
Range("A18").Select
CommandButton1.Caption = "OUI"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Else
ActiveSheet.Unprotect
Range("A11:O11").Select
Selection.Locked = False
Selection.FormulaHidden = False
Range("A1").Select
ActiveCell.FormulaR1C1 = "NON"
Range("A11").Select
CommandButton1.Caption = "NON"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub
Edit modo : code entre balises </>