XL 2016 Bouton de commande suppression texte dans cellule

Lucio

XLDnaute Junior
Bonjour,
Qui pourrait m'aider ? j'aimerais avoir un bouton qui effacerait le texte de certaines cellules et la coche des cases à cocher.
Merci d'avance de votre aide.
 

Pièces jointes

  • 2020 09 01 Permis de Travail test.xlsb.xlsm
    267.5 KB · Affichages: 20

fanch55

XLDnaute Barbatruc
Mettez le code suivant dans celui de la feuille
VB:
Option Compare Text

Private Sub CommandButton1_Click()
    For Each Elem In Me.Shapes
        If TypeName(Elem.OLEFormat.Object) = "CheckBox" Then
            Elem.OLEFormat.Object.Value = False
        ElseIf TypeName(Elem.OLEFormat.Object) = "OLEObject" Then
            If Elem.OLEFormat.progID Like "*CheckBox*" _
            Then Elem.OLEFormat.Object.Object.Value = False
        End If
    Next
    For Each Adr In Split("D38,E1,E9,E10,G5,G6,G7,G26,P5,P6,P7,M8,N19,O38,R12,R26,S31,H44,E45,R45,G51,O51,D53,H54,P53,P54,C57,I58,F59,G63,H64,P63,P64", ",")
        Me.Range(Adr) = vbNullString
    Next
End Sub
 

Lucio

XLDnaute Junior
Mettez le code suivant dans celui de la feuille
VB:
Option Compare Text

Private Sub CommandButton1_Click()
    For Each Elem In Me.Shapes
        If TypeName(Elem.OLEFormat.Object) = "CheckBox" Then
            Elem.OLEFormat.Object.Value = False
        ElseIf TypeName(Elem.OLEFormat.Object) = "OLEObject" Then
            If Elem.OLEFormat.progID Like "*CheckBox*" _
            Then Elem.OLEFormat.Object.Object.Value = False
        End If
    Next
    For Each Adr In Split("D38,E1,E9,E10,G5,G6,G7,G26,P5,P6,P7,M8,N19,O38,R12,R26,S31,H44,E45,R45,G51,O51,D53,H54,P53,P54,C57,I58,F59,G63,H64,P63,P64", ",")
        Me.Range(Adr) = vbNullString
    Next
End Sub
Merci bcp! ça fonctionne nickel!
 

fanch55

XLDnaute Barbatruc
VB:
Option Compare Text

Private Sub CommandButton1_Click()
Me.Unprotect     'Motdepasse si existe
    For Each Elem In Me.Shapes
        If TypeName(Elem.OLEFormat.Object) = "CheckBox" Then
            Elem.OLEFormat.Object.Value = False
        ElseIf TypeName(Elem.OLEFormat.Object) = "OLEObject" Then
            If Elem.OLEFormat.progID Like "*CheckBox*" _
            Then Elem.OLEFormat.Object.Object.Value = False
        End If
    Next
    For Each Adr In Split("D38,E1,E9,E10,G5,G6,G7,G26,P5,P6,P7,M8,N19,O38,R12,R26,S31,H44,E45,R45,G51,O51,D53,H54,P53,P54,C57,I58,F59,G63,H64,P63,P64", ",")
        Me.Range(Adr) = vbNullString
    Next
Me.protect     'Motdepasse si existe
End Sub
 

Lucio

XLDnaute Junior
VB:
Option Compare Text

Private Sub CommandButton1_Click()
Me.Unprotect     'Motdepasse si existe
    For Each Elem In Me.Shapes
        If TypeName(Elem.OLEFormat.Object) = "CheckBox" Then
            Elem.OLEFormat.Object.Value = False
        ElseIf TypeName(Elem.OLEFormat.Object) = "OLEObject" Then
            If Elem.OLEFormat.progID Like "*CheckBox*" _
            Then Elem.OLEFormat.Object.Object.Value = False
        End If
    Next
    For Each Adr In Split("D38,E1,E9,E10,G5,G6,G7,G26,P5,P6,P7,M8,N19,O38,R12,R26,S31,H44,E45,R45,G51,O51,D53,H54,P53,P54,C57,I58,F59,G63,H64,P63,P64", ",")
        Me.Range(Adr) = vbNullString
    Next
Me.protect     'Motdepasse si existe
End Sub
Merci bcp! c'est vraiment top! merci merci merci
 

Lucio

XLDnaute Junior
Alors j'ai une fenêtre qui s'ouvre en m'indiquant de mettre mon mot de passe, une fois fait je suis toujours protégé mais je peux ôter la protection sans pass. y a-t-il pas moyen de rester toujours protégé?
en fait , j'aimerais avoir ma feuille protégée tout le temps et ne pas avoir de fenêtre de bogue qui s'ouvre à chaque fois que j'appuie sue mon bouton de commande suppression.
 

Discussions similaires

Réponses
10
Affichages
444
Réponses
2
Affichages
131

Statistiques des forums

Discussions
312 322
Messages
2 087 288
Membres
103 508
dernier inscrit
max5554